[{"content":"\n«Ласточки летают низко — к дождю».\nЗнакомая с детства примета. И слово здесь замечательное — примета. Люди что-то приметили: иногда перед дождём ласточки действительно летают близко к земле.\nЭто наблюдение. Не глупость, не выдумка и даже не обязательно ошибка.\nНо что именно оно объясняет?\nЛасточки знают, что будет дождь? Самое простое объяснение: птицы чувствуют приближение дождя и потому снижаются.\nА теперь вспомним, чем они занимаются в воздухе. Ласточки ловят насекомых. Если мелкие летающие насекомые находятся ближе к земле, птицы будут охотиться там же.\nПочему насекомые оказались ниже? Здесь уже появляются другие вопросы: как изменились температура, воздушные потоки и погодные условия? Где сейчас больше добычи? И всегда ли низкий полёт действительно предшествует дождю?\nВ определённых условиях погода влияет на распределение насекомых по высоте, а ласточки следуют за пищей. Но низко летящая ласточка — не безошибочный прогноз погоды.\nПолучается довольно интересная вещь.\nМы видим ласточек. Но, чтобы понять их поведение, нужно посмотреть на мошек. А затем разобраться, почему изменилось поведение самих мошек.\nПримета может верно описывать закономерность и при этом ничего не доказывать о её механизме.\nА теперь посмотрим в микроскоп Представим рыбу с повреждённой кожей. Берём соскоб, смотрим препарат — и видим множество подвижных инфузорий.\nВот они. Крупные, активные, их много. В отличие от бактерий, различить их легко даже при сравнительно небольшом увеличении.\n«Так вот кто виноват!»\nНо откуда мы это знаем?\nВ том же препарате может быть огромное количество бактерий. Часть инфузорий питается бактериями, некоторые используют богатую органикой среду, а отдельные виды способны паразитировать на рыбах и повреждать ткани.\nВозможны разные последовательности событий:\nПервоначально повреждается кожа, размножаются бактерии, а затем этот участок заселяют инфузории. Инфузории сами участвуют в повреждении тканей, после чего присоединяется бактериальная микрофлора. И бактерии, и инфузории становятся многочисленными на фоне общего неблагополучия — повреждения покровов, изменения условий среды или ослабления рыбы. Это не три готовых диагноза. Это три проверяемые гипотезы. И для конкретной рыбы их нужно различать.\nНапример, Tetrahymena — вовсе не обязательно безобидный сосед. Представители этого рода могут вызывать тяжёлые поражения, в том числе с проникновением в ткани. Но обнаружить тетрахимен в соскобе и доказать, что именно они начали патологический процесс, — разные задачи.\nИ обратная ошибка ничуть не лучше: если в препарате множество бактерий, нельзя автоматически объявлять первопричиной их. Количество и заметность сами по себе не определяют причинную роль.\nСапролегния: когда «лес» виден сразу Другой знакомый пример — белые пушистые разрастания на поверхности тела рыбы.\nИх бывает видно даже без микроскопа. Под увеличением — целый лес нитей. Кажется, что диагноз очевиден: «сапролегниоз».\nНо здесь важно задать тот же вопрос: почему эти разрастания появились именно здесь?\nОомицеты рода Saprolegnia нередко заселяют уже повреждённые ткани. Перед этим могли быть травма, бактериальное поражение или нарушение защитных свойств кожи.\nОднако считать сапролегнию всегда вторичной тоже неправильно. Некоторые представители способны активно поражать живые ткани, а гифы — проникать в них и вызывать разрушение.\nПоэтому нужно различать поверхностное разрастание на повреждённом участке и инвазивное поражение тканей. По одному виду белого «пушка» историю заболевания не восстановить. Более того, не всякие обнаруженные нити можно уверенно назвать Saprolegnia без идентификации.\nОбнаружить организм в очаге поражения — ещё не значит установить, почему возник сам очаг.\nПочему мы обвиняем самого заметного? Потому что так устроено наблюдение. Ласточка крупнее мошки. Инфузория заметнее бактерии. Пучок гиф бросается в глаза сильнее, чем предшествующее ему микроскопическое повреждение кожи.\nИ чем убедительнее выглядит находка, тем проще остановиться на первом объяснении.\nНо хороший вопрос звучит не только так: «Что я вижу?»\nОн продолжается:\nПочему это здесь? Что происходило до появления находки? Чем этот организм питается или за счёт чего размножается? Повреждает ли он живые ткани или заселяет уже изменённые? Как отличить одну последовательность событий от другой? В ихтиопатологии это означает смотреть не только на самый крупный организм в соскобе, но и на состояние тканей, состав микробного сообщества, условия среды и историю развития поражения. Даже такой разбор не всегда позволит восстановить первоначальную причину, но он хотя бы покажет, какие выводы подтверждены, а какие пока остаются предположениями.\nТак при чём здесь ласточки и инфузории? Ласточки могут летать низко перед дождём. Инфузории могут массово встречаться на больной рыбе. Сапролегния может образовывать заметные разрастания на её коже.\nВсё это реальные наблюдения. Отказываться от них не нужно.\nНо наблюдать — не то же самое, что объяснять.\nЛасточки не обязаны предсказывать дождь. Инфузории не обязаны быть первичной причиной повреждения. И самый заметный организм в препарате не обязан быть самым важным в истории заболевания.\nМы замечаем то, что легче увидеть. А чтобы найти причину, иногда нужно посмотреть совсем в другую сторону.\nИсточники Royal Meteorological Society. When swallows fly high, the weather will be dry. Are birds really any good at forecasting the weather? (2010). Norwegian Veterinary Institute. Saprolegniosis (обновлено в 2026 г.). Yanong R. P. E. Fungal diseases of fish. Veterinary Clinics of North America: Exotic Animal Practice, 2003. First Report and Morphological Characterization of the Protozoan Ciliate Tetrahymena pyriformis Infecting Oreochromis niloticus. PubMed, 2025. ","permalink":"https://fossamethod.ru/ru/posts/swallows_and_infusoria/","summary":"Мы замечаем то, что крупнее и заметнее. Но чтобы объяснить увиденное, иногда нужно искать совсем другой организм — или совсем другой процесс.","title":"Ласточки и инфузории"},{"content":"\nВведение В детстве многие смотрели мультфильм «Следствие ведут Колобки». Расследование начинается с четырёх загадочных дыр в крыше. Шеф измеряет расстояние между ними рулеткой и неожиданно произносит:\n— Эти дырки — следы ног слона. Коллега смеётся: — Разве наши слоны уже летают? — Значит, летают. Представим, что я подробно опишу летающего слона. Укажу размеры, особенности строения, питание, поведение, ареал, приложу несколько аккуратных рисунков и опубликую статью в научном журнале.\nС этого момента появится публикация, на которую можно ссылаться.\nНаучная публикация не только сообщает новое утверждение. Она создаёт новый объект цитирования. С этого момента последующие авторы вынуждены учитывать его существование в литературе независимо от того, насколько убедительной была исходная доказательная база. И даже любой последующий автор сможет написать: «существует описание летающего слона» — и формально это будет правдой.\nСам факт публикации не делает существование летающего слона доказанным. Но с этого момента в научной литературе появляется опубликованное сообщение о летающем слоне. Его будут учитывать, цитировать, обсуждать, пытаться подтвердить или опровергнуть. Даже если исходная доказательная база была недостаточной.\nИменно поэтому требования к доказательной базе должны быть особенно высокими тогда, когда предлагается необычный вывод.\nОднажды я прочел книгу Виталия Танасийчука «Невероятная зоология». В одной из её частей пишется про немецкого зоолога Герольфа Штайнера. Он настолько убедительно описал несуществующий отряд животных, что многие читатели поначалу воспринимали публикацию всерьёз. Были латинские названия, рисунки, морфология, подробности поведения, систематика — всё выглядело как настоящая научная работа.\nСегодня такие истории вызывают улыбку. Но ценность этой мистификации была вовсе не в шутке. Она показала, насколько легко научная форма может создать ощущение достоверности. Такие истории напоминают о простой вещи: рассказ не является доказательством. Даже если рассказ впоследствии окажется правдивым.\nВ реальной науке ошибки происходят не потому, что исследователи обязательно хотят кого-то обмануть. Гораздо чаще проблема возникает тогда, когда вывод начинает жить отдельно от наблюдений, на которых он был основан.\nФотография не делает гипотезу истинной. Видео не заменяет эксперимент. Но без них наблюдение со временем превращается в пересказ. Благодаря этому следующий человек получает возможность не просто поверить автору, а самостоятельно оценить его наблюдения.\nНе сохраняйте только выводы. Сохраняйте данные, из которых они были сделаны. Без исходных данных любое открытие со временем превращается в пересказ.\nИменно так недостаточно документированное утверждение со временем может превратиться в широко цитируемый факт.\nЕсли научное наблюдение нельзя сохранить полностью, его следует сохранить настолько подробно, насколько это позволяют современные методы документирования.\nЛучше один раз увидеть\u0026hellip; Наблюдение существует только один раз — в тот момент, когда исследователь его видит. Всё остальное зависит от того, насколько полно удалось сохранить информацию об этом наблюдении.\nЦенность таких материалов заключается не только в их наглядности. Они позволяют следующему исследователю увидеть объект исследования самостоятельно, а не полагаться исключительно на описание автора.\nФотография, видеозапись, микропрепарат, фиксированный образец, культура микроорганизма — всё это способы сохранить наблюдение и сделать его доступным для проверки.\nЦифровая фиксация обладает не только документальной, но и образовательной ценностью. Она позволяет показать процессы, которые раньше описывались словами или изображались схематично.\nПочему стоит сохранять видео? Фотография фиксирует момент. Видео фиксирует процесс. Ваш браузер не поддерживает видео. Развитие кринок барбуса суматранского. Во многих случаях именно процесс содержит информацию, которую невозможно увидеть на отдельном кадре. В качестве примера можно привести таймлапс развития икры.\nПокадровая съёмка позволяет наблюдать не только последовательность изменений, но и скорость процессов, время их наступления и особенности отдельных стадий развития.\nИменно благодаря таким материалам становится возможным уточнять существующие описания и выявлять детали, которые трудно заметить при эпизодических наблюдениях.\nДругие примеры документированных наблюдений:\nМикрофотографии\rГалерея\rИзображения, видео и визуальные наблюдения\rВидеонаблюдения\rМикроскопические наблюдения\rВидео, таймлапсы и микроскопические наблюдения\rИстория документирования наблюдений В XIX и начале XX века биологический рисунок был основным способом документирования наблюдений. Возможности фотографии были ограничены, поэтому исследователь стремился максимально точно передать увиденное с помощью рисунка.\nС развитием микрофотографии, а затем цифровой фото- и видеосъёмки ситуация принципиально изменилась. Появилась возможность сохранять не только интерпретацию наблюдения, но и само наблюдение. Современные методы позволяют документировать морфологию, поведение и динамику процессов с полнотой, которая ранее была недоступна.\nБиологический рисунок при этом не утратил своего значения. Он помогает выделить диагностически важные детали, упростить восприятие сложных структур и обратить внимание читателя на признаки, имеющие таксономическое значение. Именно поэтому существует понятие «биологический рисунок» — это не фотографическая копия объекта, а его интерпретация исследователем.\nОднако рисунок как единственное свидетельство наблюдения принципиально непроверяем.\nИменно поэтому сегодня фотографии и видеозаписи являются не просто иллюстрациями, а важной частью доказательной базы научной публикации.\nСпустя годы невозможно установить, отражает ли он реальное наблюдение, его интерпретацию или фантазию автора. Если первичные данные отсутствуют, рисунок перестаёт быть средством проверки и становится лишь утверждением автора.\nИменно поэтому в современной науке рисунок должен дополнять фотографию или видеозапись, а не заменять их.\nЧем необычнее вывод, тем выше должны быть требования к сохранению исходных данных.\nЗачем всё это аквариумисту? Многие считают, что микроскоп нужен только учёным.\nНа самом деле он нужен каждому, кто хочет не пересказывать чужие выводы, а делать собственные наблюдения.\nФотография через окуляр, видеозапись движения паразита, серия снимков одного и того же объекта — это не красивые иллюстрации. Это первичные данные, к которым можно вернуться спустя месяцы или годы, показать их другому специалисту и сравнить с новыми наблюдениями.\nБез этого любое описание постепенно превращается в рассказ.\nМикроскоп позволяет не только увидеть объект. Он позволяет сохранить наблюдение.\nВопросы и ответы У меня нет микроскопа. Значит, статья не для меня? Нет. Принцип касается любых наблюдений. Если можно сохранить фотографию, видео или иной первичный материал — это следует сделать.\nРазве фотография является доказательством? Нет.\nФотография фиксирует наблюдение. Доказательством становится совокупность независимых наблюдений, экспериментов и их анализа.\nА если фотографии нет? Тогда ценность наблюдения не исчезает. Однако его становится значительно сложнее проверить независимо.\nА если фотографии противоречат моему выводу? Тем лучше.\nЦель фотографии — не подтвердить ожидания автора, а сохранить наблюдение таким, каким оно было. Если вывод не выдерживает проверки первичными данными, значит, пересматривать нужно вывод, а не данные.\nРазве рисунки больше не нужны? Нужны.\nБиологический рисунок помогает выделить признаки, которые трудно заметить на фотографии.\nНо рисунок не должен оставаться единственным свидетельством наблюдения.\nПочему это важно именно для аквариумистов? Потому что заболевания проходят, рыбы погибают, препараты заканчиваются, а фотографии, видео и микропрепараты остаются. Именно они позволяют позже разобраться, что произошло на самом деле.\n","permalink":"https://fossamethod.ru/ru/posts/elephantfly/","summary":"Почему наблюдение ещё не является доказательством. Зачем сохранять фотографии, видео и препараты, и как отличить убедительную гипотезу от воспроизводимого знания.","title":"Летающие слоны"},{"content":"Что считать доказательством в эпоху искусственного интеллекта? Искусственный интеллект не устраняет летающих слонов.\nОн помогает им получить убедительное обоснование. Fossa От рассказа к документированию Подводка, или первая часть статьи, находится здесь.\rЛетающие слоны\rПочему в науке недостаточно красивой гипотезы. О роли фотографий, видео, препаратов и исходных данных в построении и проверке научных …\rСначала знание передавалось как рассказ. Потом появились более строгие описания: размеры, признаки, латинские названия, сравнения, диагнозы. Потом биологический рисунок стал способом показать объект, который читатель сам не видел.\nНо рисунок всё равно оставался не самим наблюдением, а его авторской реконструкцией. Рисунок как единственное свидетельство принципиально непроверяем, потому что спустя годы нельзя установить, отражает ли он реальное наблюдение, интерпретацию или фантазию автора.\nДалее появились фотографии и видео. Они не сделали выводы автоматически истинными, но повысили возможность независимой проверки. Фотография фиксирует момент, видео фиксирует процесс.\nНе все статьи одинаково документированы Очень важный момент: проблема недостаточной доказательной базы существовала и до ИИ.\nНапример, в ихтиопатологии часто можно встретить логику:\nвзяли соскоб / посев → выросла бактерия → значит, она и вызвала заболевание\rКогда микроскопия мазка важнее бакпосева?\rИстория о том, почему микроскопия мазка не менее важна, чем бактериологический посев, и как отсутствие воспаления не всегда означает …\r.\nНо между “бактерия выросла” и “бактерия была причиной гибели” есть огромная дистанция. Нужны клиническая картина, фотографии поражений, микроскопия тканей, воспалительная реакция, повторяемость, исключение фоновой микрофлоры, связь с очагом поражения, иногда экспериментальное подтверждение.\nЕсли этого нет, доверие к выводу должно снижаться. Не потому что автор обязательно неправ. А потому что читателю не дают достаточного доступа к наблюдению.\nОтсутствие фотографии не делает вывод ложным.\nОно увеличивает долю доверия к автору и уменьшает долю самостоятельной проверки.\nРисунок вместо фотографии — уже регресс Для своего времени биологический рисунок был серьёзным способом документирования. Но в статье, где уже технически возможны микрофотографии, видео, серия препаратов или сохранённый материал, один рисунок перестаёт быть достаточным основанием для необычного вывода.\nТо есть необычность вывода высокая, а видимая проверяемость для читателя ограничена. Это не обязательно надо прямо разносить в новой статье. Но как внутренний пример — идеально.\nЧем необычнее вывод, тем меньше он должен держаться на доверии к автору.\nКогда фотография снова стала рисунком Долгое время развитие документирования шло в одну сторону: от рассказа к материалу, который можно показать другому человеку. Рассказ можно было пересказать. Рисунок можно было нарисовать. Но фотография и видео воспринимались как более близкие к самому событию.\nПочти два столетия развитие средств документирования шло в одном направлении. Каждая новая технология уменьшала необходимость доверять автору на слово. Рисунок уступил место фотографии, фотография — видео. Казалось, что доказательная база становится всё надёжнее.\nГенеративный ИИ впервые изменил эту привычную траекторию. Теперь можно создать не только рассказ и рисунок, но и фотографию, видео, голос, таблицу, литературный обзор и правдоподобное объяснение события, которого не было.\nСегодня качественная фотография или видеозапись уже не гарантируют, что наблюдение действительно существовало. В этом смысле мы неожиданно оказались в положении исследователей начала прошлого века: изображение снова требует доверия к автору.\nНазад в будущее доказательств XVIII век «Я видел» Верите? XIX век «Вот рисунок» Уже лучше XX век «Вот фотография» Отлично XXI век «Вот видео» Почти идеально Эпоха ИИ «Вот фотография» А откуда она? Мы не вернулись к рисункам. Мы вернулись к необходимости доверять автору.\nПарадоксально, но развитие технологий почти вернуло нас к началу XX века. Тогда рисунок требовал доверия к автору. Сегодня этого же доверия всё чаще требуют фотография и видео. Мы снова сидим с фотографиями и видеозаписями так же, как когда-то сидели с биологическими рисунками. Это не делает ИИ врагом науки\u0026hellip;просто происхождение данных стоновится частью доказательства.\nГлавный вывод Раньше слабое место было в пересказе. Потом — в авторской интерпретации. Сейчас слабое место сместилось к происхождению данных.\nКачество изображения больше не гарантирует качество наблюдения.\nКачество изображения всё чаще гарантирует только качество изображения.\nКачество текста больше не гарантирует качество доказательств.\nКачество объяснения больше не гарантирует существование объекта.\nИскусственный интеллект не сделал научный метод ненужным. Наоборот, он снова показал, зачем этот метод нужен\rНаучный метод. Инструкция по применению.\rО том, как формируется знание, почему уверенность часто опережает понимание и как научный метод помогает не путать наблюдение с объяснением.\r.\nЕсли раньше можно было спросить: “Есть фотография?”, то теперь приходится спрашивать: “Откуда появилась эта фотография?”\nЕсли раньше видеозапись уменьшала расстояние между наблюдением и читателем, то теперь сама видеозапись нуждается в истории происхождения. Кто её сделал? Когда? Где? На каком объекте? Есть ли серия исходных кадров? Есть ли RAW-файлы? Есть ли препарат, образец, журнал наблюдений, повторная регистрация, независимое подтверждение?\nМатериальные доказательства не стали менее важными. Микропрепарат, фиксированный материал, культура микроорганизма, образец ткани, журнал наблюдений, серия исходных снимков или сохранённый объект исследования остаются тем, чем были всегда: возможностью вернуться к наблюдению и проверить его повторно.\nНо в научной статье читатель чаще всего сталкивается не с самим объектом, а с его представлением. Он видит фотографию, рисунок, таблицу, описание, видеокадр или объяснение автора. Именно в этом месте и возникает новый вопрос. Если раньше изображение помогало приблизить читателя к объекту, то теперь само изображение должно иметь прослеживаемое происхождение.\nПроблема не в том, что исчезли материальные доказательства. Проблема в том, что в публичном распространении знания всё чаще циркулирует не объект, а его убедительная цифровая оболочка.\nДоказательством становится не изображение само по себе, а возможность проследить путь от объекта к изображению.\nНаука долго училась сохранять наблюдение. Теперь ей приходится учиться сохранять происхождение наблюдения. Частые вопросы Значит ли это, что фотография больше ничего не доказывает? Нет. Фотография остаётся важным элементом доказательной базы. Но теперь она не должна рассматриваться отдельно от своего происхождения: кто её сделал, когда, где, на каком объекте и при каких условиях.\nВидео надёжнее фотографии? Видео фиксирует процесс, поэтому во многих случаях даёт больше информации, чем отдельный кадр. Но само по себе видео тоже нуждается в истории происхождения. Важно не только то, что показано, но и откуда взялась запись.\nИскусственный интеллект делает научные изображения бесполезными? Нет. Он делает бесполезной наивную уверенность в том, что качественное изображение автоматически равно реальному наблюдению. Изображение по-прежнему ценно, если его можно связать с объектом, условиями наблюдения и исходными данными.\nЧто важнее: красивая иллюстрация или исходные материалы? Исходные материалы. Красивая иллюстрация помогает объяснить мысль, но не заменяет наблюдение. Чем необычнее вывод, тем важнее сохранять фотографии, видео, препараты, журналы наблюдений и другие первичные данные.\nЕсли автору доверяют, нужна ли такая проверка? Нужна. Наука строится не только на доверии к человеку, но и на возможности проверить путь от наблюдения к выводу. Доверие помогает начать разговор, но не должно заменять доказательства.\nМожет ли слабая доказательная база сопровождать правильный вывод? Да. Вывод может быть верным даже при слабой документации. Но для читателя такая работа остаётся менее проверяемой: приходится больше доверять автору и меньше опираться на собственную оценку данных.\nЧто теперь считать хорошим доказательством? Не отдельную фотографию, видео или убедительный текст, а связку данных. Наблюдение, условия, исходные файлы, повторяемость, независимые подтверждения и понятная цепочка от объекта к выводу вместе создают более надёжную доказательную базу.\n","permalink":"https://fossamethod.ru/ru/posts/ai_forever/","summary":"Продолжение статьи «Летающие слоны»: раньше рассказ не был доказательством, теперь даже фотография и видео требуют истории происхождения. Что считать доказательством в эпоху искусственного интеллекта?","title":"Какие ваши доказательства?"},{"content":"\nЯ не собираюсь создавать философию или систему взглядов. Я просто пытаюсь разобраться в вопросах, которые кажутся мне незавершёнными.\nПочему рыба погибла?\nПочему лечение не сработало?\nПочему одинаковые симптомы приводят к разным выводам?\nПочему многие объяснения звучат убедительно, но не объясняют механизм происходящего?\nПочему некоторые вопросы считаются закрытыми, хотя при ближайшем рассмотрении оказывается, что никто не может уверенно объяснить детали?\nСо временем стало заметно, что похожие проблемы встречаются не только в ихтиопатологии. Они появляются в науке, образовании, инженерии, медицине, управлении и даже в повседневной жизни. Очень часто спор идёт не о фактах, а о способе мышления. Не о том, что известно, а о том, как люди приходят к своим выводам. Так постепенно сформировался набор принципов, которые я постоянно использую при работе с гидробионтами, анализе данных, изучении литературы и построении объяснений. Этот набор принципов и получил название Fossa Method.\nКоротко Начинай с наблюдения, а не с объяснения. Не путай описание с причиной. Любая система имеет ограничения. Любая модель имеет границы. Простота должна быть результатом понимания. Сложность нельзя отменить. Демистифицируй знания. Ищи противоречия. Уважай объект исследования. История важнее самого ответа. Понимание и Знание должны находиться в равновесии. Объяснение должно открывать дверь, а не закрывать вопрос. Авторитет не заменяет механизм. Происхождение утверждения не заменяет его проверку. Следствие не доказывает единственную причину. I. Наблюдение 1. Начинай с наблюдения, а не с объяснения Самая частая ошибка — объяснять явление до того, как оно описано.\nПример.\rРыба плавает у поверхности и тяжело дышит. Это наблюдение. Фраза «у неё бактериальная инфекция» — уже объяснение, которое пока ничем не подтверждено. Сначала необходимо описать симптомы, затем искать их причину.\nСначала: \u0026ldquo;что произошло?\u0026rdquo;, \u0026ldquo;что увидели?\u0026rdquo;, \u0026ldquo;что измерили?\u0026rdquo;, \u0026ldquo;что зафиксировали?\u0026rdquo;. Только потом: \u0026ldquo;почему это произошло?\u0026rdquo;.\n2. Не путай описание с причиной Описание не является объяснением.\nПример.\rФраза «рыба погибла из-за стресса» не объясняет механизм гибели. Необходимо уточнить, что именно произошло: отказ от корма, травма, нарушение осморегуляции, угнетение дыхания или другой процесс, который можно наблюдать и проверить.\nНастоящий вопрос: \u0026ldquo;Какой механизм привёл к наблюдаемому результату?\u0026rdquo;\nII. Ограничения 3. Любая система имеет ограничения Система — это набор взаимосвязанных элементов, которые работают вместе для достижения определённой цели.\nВ аквариумистике системой может быть аквариум, фильтрация, коллектив рыб или даже организация работы персонала. Изменение одного элемента неизбежно влияет на остальные.\nПример.\rУвеличение плотности посадки рыб позволяет содержать больше животных в том же объёме воды, но одновременно повышает нагрузку на систему фильтрации и увеличивает риск конфликтов между особями.\rОграничения нельзя устранить.\nИх можно только перераспределить.\nЛюбое решение создаёт новые ограничения.\nПоэтому вопрос всегда должен звучать так: \u0026ldquo;Какое ограничение мы пытаемся изменить и что появится взамен?\u0026rdquo;\n4. Любая модель имеет границы Модель — это упрощённое описание реальности, которое помогает понять или предсказать поведение объекта.\nЛюбая модель отбрасывает часть деталей ради удобства использования.\nМодель может быть математической, биологической, инженерной или даже словесной.\nПример.\rЛекарственный препарат может эффективно работать против одного паразита, но быть бесполезным против другого. Метод, успешно решающий одну задачу, не становится универсальным решением для всех случаев.\nФраза «плавниковая гниль вызывается бактериями» является моделью, объясняющей часть случаев разрушения плавников. Однако она не учитывает травмы, нарушения питания, кровоизлияния и другие причины, которые могут приводить к похожим изменениям. Модель полезна до тех пор, пока мы помним её границы.\rНет универсальных решений. Нет препаратов от всего. Нет диагностических признаков на все случаи. Нет методик, одинаково работающих в любых условиях.\nВопрос не в том: \u0026ldquo;Работает ли модель?\u0026rdquo;\nВопрос в другом: \u0026ldquo;Где она перестаёт работать?\u0026rdquo;\nIII. Понимание 5. Простота должна быть результатом понимания Пример.\rФраза «газово-пузырьковая болезнь возникает из-за избытка растворённых газов» упрощает явление, но сохраняет его механизм. Фраза «болезнь возникает из-за пузырьков в воде» выглядит проще, но уже искажает суть процесса.\rУпрощать полезно.\nПримитивизировать опасно.\nХорошее объяснение:\nубирает лишнее; сохраняет главное; показывает механизм. Плохое объяснение:\nубирает сам механизм. 6. Сложность нельзя отменить Пример.\rДля обнаружения некоторых паразитов достаточно микроскопа и простого мазка. Однако установить точную природу части заболеваний без дополнительных исследований невозможно. Простота полезна там, где она не искажает реальность.\rНекоторые вещи действительно сложны.\nЕсли объект сложен, описание тоже может оказаться сложным.\nСложность не является ошибкой.\nОшибка — скрывать сложность или делать вид, что её не существует.\n7. Демистифицируй знания Пример.\rОкраска препарата по Цилю может показаться сложной лабораторной процедурой. Однако её задача сводится к двум действиям: окрасить объект и затем удалить краситель из окружающих тканей, сохранив его в микобактериях.\rСложные слова не делают мысль глубокой.\nТерминология нужна для точности, а не для создания авторитета.\nЗнания должны становиться доступнее, а не загадочнее.\nIV. Поиск 8. Ищи противоречия Пример.\rЕсли все признаки указывают на бактериальное заболевание, но бактериологические исследования этого не подтверждают, именно это противоречие становится поводом пересмотреть первоначальную версию.\rНаиболее интересны не подтверждения.\nНаиболее интересны наблюдения, которые не укладываются в существующую картину.\nИменно они двигают понимание вперёд.\n9. Уважай объект исследования Пример.\rНекачественно выполненное вскрытие может уничтожить признаки заболевания ещё до их изучения. Аккуратная работа позволяет сохранить информацию, которая позже может оказаться ключевой для понимания причины гибели.\rРыба — не статистическая единица.\nПрепарат — не ритуал.\nВскрытие — не формальность.\nКаждое наблюдение — источник информации.\nЗадача исследователя не подтвердить заранее выбранную версию, а понять, что произошло на самом деле.\nV. Развитие 10. История важнее самого ответа Пример.\rЗнание того, что врачи начали мыть руки перед операциями, полезно. Но ещё важнее понимать, какие наблюдения привели к этому выводу и почему современники долгое время отвергали эту идею.\rКонечный вывод полезен.\nНо ещё полезнее понимать:\nкак к нему пришли; какие ошибки совершили; какие альтернативы рассматривали; почему одни идеи оказались ложными, а другие выжили. История поиска часто ценнее готового результата.\n11. Понимание и Знание должны находиться в равновесии Пример.\rМожно выучить схему жизненного цикла паразита, не понимая её смысла. Можно, наоборот, рассуждать о паразитах, не зная их биологии. Полезными знания становятся только тогда, когда понимание и факты поддерживают друг друга.\rЗнание без понимания превращается в заучивание.\nПонимание без знания превращается в фантазии.\nРазвитие возникает только тогда, когда присутствуют оба компонента одновременно.\n12. Объяснение должно открывать дверь, а не закрывать вопрос Пример.\rХорошее объяснение позволяет человеку сделать следующий шаг самостоятельно. Оно показывает основную модель явления, но не создаёт иллюзии, что тема исчерпана полностью.\rПлохое объяснение:\n\u0026ldquo;Всё просто. Запомни и не думай.\u0026rdquo;\nДругая крайность:\n\u0026ldquo;Всё настолько сложно, что не лезь.\u0026rdquo;\nОбе позиции одинаково вредны.\nХорошее объяснение выглядит так:\n\u0026ldquo;Вот минимальная модель, которая позволяет начать понимать явление. Но это не вся картина.\u0026rdquo;\nОбъяснение должно быть достаточно простым, чтобы человек смог войти в тему, и достаточно честным, чтобы он понимал существование следующих уровней понимания.\n13. Авторитет не заменяет механизм Пример.\rЗаключение специалиста имеет значение, но его ценность возрастает, когда можно понять, на основании каких наблюдений и данных сделан вывод.\rДолжность не является доказательством.\nСтаж не является доказательством.\nКоличество публикаций не является доказательством.\nЕсли механизм нельзя объяснить, авторитет не делает объяснение верным.\n14. Происхождение утверждения не заменяет его проверку. Пример.\rТо, что утверждение получено от преподавателя, специалиста, организации или принято в профессиональной среде, не доказывает его истинность. Источник может повысить доверие к сообщению, но не освобождает само утверждение от проверки.\r15. Следствие не доказывает единственную причину. Пример.\rЕсли определённая причина способна вызвать наблюдаемый признак, это не означает, что наличие такого признака подтверждает именно эту причину. Токсическое воздействие может разрушать жабры, но разрушенные жабры сами по себе не доказывают токсикоз.\rВопросы и ответы Это новый научный метод? Нет.\nНаучный метод появился задолго до меня и прекрасно работает без каких-либо дополнений.\nFossa Method не заменяет научный метод. Это попытка сформулировать принципы, которые помогают задавать вопросы, строить объяснения и не путать наблюдения с интерпретациями.\nЭто философия? Скорее нет.\nЭто набор практических наблюдений, которые постепенно сформировались во время работы с гидробионтами, диагностики заболеваний, анализа данных и изучения истории науки.\nПочему не использовать просто научный метод? Научный метод отвечает на вопрос:\nКак проверять гипотезы?\nFossa Method чаще отвечает на другой вопрос:\nКак вообще понять, какой вопрос стоит задавать?\nПочему здесь много говорится об ограничениях? Потому что большинство ошибок возникает не из-за отсутствия решений, а из-за игнорирования ограничений.\nЛюбое решение что-то улучшает и одновременно создаёт новые проблемы.\nПоэтому прежде чем что-либо менять, полезно понимать, какое ограничение мы пытаемся изменить и что появится взамен.\nПочему много внимания уделяется наблюдению? Потому что объяснения часто появляются раньше наблюдений.\nЧеловек видит явление и сразу находит для него причину.\nНо между наблюдением и объяснением всегда должен оставаться вопрос:\nЧто именно мы увидели?\nПочему вы критикуете авторитеты? Я не критикую авторитеты.\nЯ критикую ситуации, когда авторитет подменяет объяснение.\nОпыт, знания и квалификация имеют значение.\nНо ни должность, ни стаж сами по себе не являются доказательством.\nПочему сайт посвящён рыбам, а эта страница говорит о мышлении? Потому что большинство статей на сайте появились не из готовых ответов, а из попыток разобраться в вопросах, которые казались незавершёнными.\nСо временем стало понятно, что одни и те же принципы работают не только в ихтиопатологии, но и в инженерии, медицине, программировании, образовании и научных исследованиях.\nЧто является главным принципом Fossa Method? Если выбирать только один принцип, то он звучал бы так:\nНе начинай с ответа. Начинай с вопроса.\n","permalink":"https://fossamethod.ru/ru/posts/fossa-method/","summary":"Не ответы, а принципы их поиска.","title":"Fossa Method."},{"content":" Введение Вопрос «откуда ты это знаешь?» часто раздражает. Не потому что он неправильный — а потому что на него трудно ответить честно. В большинстве случаев ответ звучит уверенно, но опирается не на проверку, а на привычку, опыт или чужие слова.\nПроблема не в том, что мы не знаем. Проблема в том, что мы не знаем — и при этом уверены, что знаем.\rКак формируется знание Знание не появляется как готовый ответ. Оно собирается постепенно — из наблюдений, ошибок и попыток объяснить увиденное. История науки — это не череда открытий, а цепочка уточнений. Новые данные редко опровергают всё сразу. Чаще они делают прежние объяснения недостаточными. Даже простые вопросы могут требовать лет наблюдений и проверки. Иногда — всей жизни.\nЧто мы часто принимаем за знание: то, что «везде пишут» то, что «всегда так делали» то, что «похоже на знакомый случай» то, что удобно объясняет наблюдаемое Все эти вещи могут быть полезны. Но сами по себе они не являются доказательством.\nСамая опасная ошибка — не отсутствие знаний, а уверенность в объяснении, которое не проверено.\rВ рыбной патологии это становится особенно заметно. Один и тот же симптом может иметь разные причины. Похожие изменения могут возникать при совершенно разных процессах. Наличие признака ещё не означает понимание механизма.\nПузырьки газа — не всегда газово-пузырьковая болезнь. Белые точки — не всегда один и тот же паразит. Гиперемия — не всегда воспаление.\nБез метода наблюдение легко превращается в догадку, а догадка — в уверенное объяснение.\rЧто такое научный метод на практике Научный метод — это не формула и не набор терминов. Это способ работы с реальностью.\nОн включает в себя:\nнаблюдение фиксацию условий сопоставление признаков проверку альтернатив отказ от удобного объяснения, если оно не выдерживает проверки Это не гарантирует правильный ответ. Но снижает вероятность уверенной ошибки.\nПри таком подходе меняется не только результат, но и сам процесс. становится меньше «быстрых диагнозов» уменьшается количество ритуального лечения появляется понимание причин, а не только симптомов возрастает осторожность в выводах И главное — появляется возможность отличать наблюдение от интерпретации.\nНаучный метод не делает работу проще...он делает её честнее.\rОн не избавляет от ошибок....но не позволяет им оставаться незамеченными.\rЭто не способ всегда быть правым - это способ не ошибаться слишком уверенно.\rОсновные правила Метод не начинается с ответа. Он начинается с наблюдения.\r1. Сбор данных Наблюдение должно быть отделено от интерпретации. Фиксируется то, что видно:\nповедение рыбы\nвнешний вид\nизменения во времени\nусловия содержания\nВажно не объяснять, а описывать. Не «рыба больна», а «рыба лежит на дне, дыхание учащено».\r2. Фиксация условий Любое наблюдение имеет контекст. Без него данные теряют смысл.\nФиксируются:\nтемпература\nпараметры воды\nизменения в системе\nкормление\nпересадки, стресс\nОдин и тот же симптом в разных условиях — это разные ситуации.\r3. Ведение записей Память искажает последовательность событий. Записи — нет.\nФиксируется:\nчто произошло\nкогда\nпри каких условиях\nчто изменилось после вмешательства\nБез записей невозможно понять, что было причиной, а что — следствием.\r4. Сопоставление признаков Один признак не даёт диагноза. Значение имеет только их сочетание.\nСравнивается:\nкакие признаки совпадают\nкакие противоречат\nчто отсутствует, хотя ожидалось\nОтсутствие признака иногда важнее его наличия.\r5. Проверка альтернатив Первое объяснение почти всегда самое удобное. И часто — неверное.\nНеобходимо задать вопрос: что ещё может это объяснить?\nЕсли есть хотя бы одна альтернативная версия — она должна быть рассмотрена.\r6. Минимальное вмешательство Вмешательство меняет систему. Иногда быстрее, чем мы успеваем понять, что происходило.\nЧем больше воздействий одновременно:\nтем сложнее понять причину\nтем выше риск ошибочного вывода\nЛучше меньше действий, но с пониманием их эффекта.\r7. Проверка результата Любое действие — это гипотеза. Результат — это проверка.\nЕсли после вмешательства стало лучше, это не всегда означает, что причина найдена.\rЕсли не стало — это не всегда означает, что гипотеза неверна.\rОцениваться должно:\nчто изменилось как быстро насколько устойчиво * Важно Метод — это не последовательность шагов, которые нужно «пройти».\rЭто способ мышления, который применяется на каждом этапе.\rОн не требует сложного оборудования.\rОн требует аккуратности в наблюдении и честности в выводах.\rИменно это отличает знание от предположения.\nЛитература Ferguson, H.W., 2006. Systemic Pathology of Fish: A Text and Atlas of Comparative Tissue Responses in Diseases of Teleosts, 2nd ed. Scotian Press, London. Kuhn, T.S., 2012. The Structure of Scientific Revolutions, 4th ed. University of Chicago Press, Chicago. Noga, E.J., 2010. Fish Disease: Diagnosis and Treatment, 2nd ed. Wiley-Blackwell, Ames. Popper, K.R., 2002. The Logic of Scientific Discovery. Routledge, London. Вопросы и ответы Почему одного симптома недостаточно для диагноза? Потому что один признак может возникать при разных процессах.\nЧто важнее — опыт или метод? Метод. Опыт без проверки часто приводит к ошибкам.\nПочему нельзя сразу лечить? Потому что вмешательство изменяет систему и мешает понять причину.\nЧто значит «проверка альтернатив»? Рассмотрение других возможных объяснений, а не только первого пришедшего в голову.\nМожно ли ошибаться при использовании метода? Да, но вероятность уверенной ошибки становится значительно ниже.\n","permalink":"https://fossamethod.ru/ru/posts/science/","summary":"Практический взгляд на научный метод: как не ошибаться слишком уверенно и отличать знание от предположений.","title":"Научный метод. Инструкция по применению."},{"content":" Глубина разбора F. F.O. F.O.S. Знание ограничений метода не просто защищает от неправильных выводов — оно подсказывает, где и как искать то, чего мы пока не видим. Fossa Циль–Нильсен без полного набора реактивов: что всё ещё можно узнать? Если есть полноценная лаборатория, все необходимые реактивы и нормальные условия работы, вопрос решается просто: для проверки кислотоустойчивости бактерий следует выполнить стандартную окраску по Цилю–Нильсену.\nЭтот текст не о том, как заменить стандартный метод там, где он доступен.\nОн о другой ситуации — гораздо более обычной для небольших хозяйств, океанариумов, ихтиопатологов без отдельной бактериологической лаборатории и даже аквариумистов с микроскопом. Диагностическая задача есть, препарат перед глазами есть, а полного набора реактивов — нет.\nФенол токсичен, неприятен в работе и требует нормальных условий хранения и использования.\nСильные минеральные кислоты тоже не относятся к тем веществам, которые хочется держать «на всякий случай» рядом с микроскопом. Их нужно приобретать, хранить и использовать с соответствующими мерами безопасности.\nЕсли часть классического метода недоступна, означает ли это, что из препарата уже нельзя получить полезную информацию?\nМожно воспринимать дальнейшее как небольшое методическое развлечение: убрать один этап, заменить другой и посмотреть, что именно изменится. А можно — как вполне практическую необходимость.\nВ обоих случаях правило одно:\nВажно понимать, что именно происходит при каждом действии, что мы узнаём благодаря ему и о чём уже не сможем судить, если его убрать или изменить.\nЧто именно делает классический метод — и откуда он вообще взялся? Окраска по Леффлеру Окраска по Цилю — Нильсену В этом мазке простая окраска выявляет палочковидные структуры хуже, чем специальная.\nОкрашивание по Цилю–Нильсену используют для выявления кислотоустойчивых бактерий, в том числе микобактерий (World Health Organization, 1982). Но положительная окраска сама по себе не определяет род бактерии.\nНо интересно, что привычная сегодня схема появилась не сразу. То, что мы называем «методом Циля–Нильсена», фактически сложилось за очень короткое время из последовательных изменений уже существовавших способов окраски (Vilchèze \u0026amp; Kremer, 2017).\nВ марте 1882 года Роберт Кох, представляя работу о возбудителе туберкулёза, описал окрашивание материала горячим щелочным раствором метиленового синего с последующей контрастной окраской везувином — бисмарковым коричневым. Микобактерии становились синими на коричневом фоне (Vilchèze \u0026amp; Kremer, 2017).\nУже в мае того же года Пауль Эрлих изменил метод. Вместо метиленового синего он использовал фуксин или метиловый фиолетовый в насыщенной анилиновой воде, а затем обесцвечивал препарат 30% азотной кислотой и применял контрастный краситель (Vilchèze \u0026amp; Kremer, 2017).\nСледующий шаг сделал Франц Циль. В августе 1882 года он заменил анилиновое масло карболовой кислотой — фенолом. Полученный карболовый фуксин оказался стабильнее анилинового раствора Эрлиха (Vilchèze \u0026amp; Kremer, 2017).\nВ октябре 1882 года Эдуард Риндфляйш предложил непосредственно нагревать препарат во время окрашивания.\nА в июле 1883 года Фридрих Нильсен опубликовал свою модификацию метода Циля: 0,75% фуксина в 5% растворе карболовой кислоты с последующим обесцвечиванием 25% серной кислотой (Vilchèze \u0026amp; Kremer, 2017).\nТо есть фенол появился в методе не как неизменная часть некоего изначального рецепта.\nЕго ввёл Циль вместо анилина, нагрев добавил Риндфляйш, а Нильсен изменил состав красителя и условия обесцвечивания.\nЗа примерно шестнадцать месяцев исходный способ Коха успел несколько раз существенно измениться и только позднее закрепился под привычным названием Ziehl–Neelsen staining (Vilchèze \u0026amp; Kremer, 2017).\nНа этом развитие метода тоже не закончилось.\nВ 1887 году Габбетт попытался сократить процедуру, объединив кислотное обесцвечивание с контрастной окраской. А в 1915 году Джозеф Киньон предложил «холодный» вариант без нагревания: концентрацию фуксина увеличили примерно до 3,1%, фенола — до 6,25%, а в качестве деколоризатора использовали 3% соляную кислоту (Vilchèze \u0026amp; Kremer, 2017).\nТо есть даже исторически метод развивался именно так:\nЗадача оставалась той же, а способ её решения менялся: заменяли реагенты, меняли концентрации и режим воздействия.\nА что сегодня называют классической схемой? В современных вариантах препарат окрашивают карболовым фуксином с нагреванием, затем проводят кислотное или кислотно-спиртовое обесцвечивание и докрашивают контрастным красителем (World Health Organization, 1982) (World Health Organization, 1999).\nОдин из вариантов деколоризатора — 3%-й кислый спирт:\n3 мл концентрированной соляной кислоты + 97 мл 95%-го этилового спирта.\nВ этой рецептуре «3%» обозначает принятое объёмное соотношение исходной концентрированной кислоты и спирта, а не точную массовую долю чистого HCl (World Health Organization, 1998).\nПри этом это уже не первоначальная формула Нильсена. В его варианте 1883 года использовалась 25% серная кислота.\nТо же касается первичного красителя. Нильсен использовал 0,75% фуксина в 5% феноле. В дальнейшем состав меняли неоднократно: Vilchèze и Kremer приводят для одного из современных вариантов ZN 0,3% фуксина и 5% фенола, а для холодной окраски по Киньону — значительно более высокие концентрации (Vilchèze \u0026amp; Kremer, 2017).\nИ это важно для понимания метода:\nНет одной-единственной концентрации, навсегда закреплённой за названием «Циль–Нильсен». Есть задача, которую решает каждая операция, и условия, при которых она даёт воспроизводимый результат.\nЗнать границы метода — значит иметь возможность им управлять Если смотреть на метод как на рецепт, всё просто:\nфуксин → нагрев → кислота → докраска.\nНо если разобраться, зачем мы делаем каждое из этих действий, картина становится интереснее:\nкарболовый фуксин обеспечивает интенсивное окрашивание; фенол и нагревание помогают красителю проникнуть в плохо прокрашивающиеся структуры; кислотное обесцвечивание проверяет способность окрашенных структур удерживать фуксин; контрастная окраска делает фон удобным для микроскопии. Поэтому исключение одного действия не обязательно делает весь результат бесполезным.\nЧасть наблюдений остаётся, но некоторые выводы уже нельзя сделать.\nЗнаешь границы метода — можешь им управлять.\nНе знаешь границ — остаётся только следовать рецепту.\nЕсли бактерии не видны, мы не знаем, отсутствуют они в ткани или просто не выявляются используемым способом.\nЕсли после окрашивания мы их увидели — это уже факт наблюдения. Можно оценить форму, количество, распределение бактерий и их связь с патологическими очагами.\nА вот что именно доказано этим наблюдением, зависит от того, как мы получили изображение. Красные палочки видны; но удержали бы они фуксин после кислоты — отдельный вопрос.\nКислотоустойчивость — ещё не микобактерии Ветвящиеся скопления Есть ещё одна ловушка: обнаружить кислотоустойчивые палочки — не значит обнаружить именно Mycobacterium. Среди возбудителей болезней рыб встречаются и Nocardia — актиномицеты, способные вызывать гранулематозные поражения внутренних органов (Maekawa et al., 2018).\nНокардии могут выглядеть как длинные палочки, нитевидные структуры и ветвящиеся скопления. Для них характерна частичная, или вариабельная, кислотоустойчивость: при более мягком обесцвечивании часть бактерий удерживает фуксин, при более жёстком окраска может утрачиваться. В одном препарате могут соседствовать окрашенные и слабо окрашенные участки. Это свойство оценивают по результату обработки, а не по тому, насколько палочка длинная, кривая или ветвистая (Brown-Elliott et al., 2006).\nВ работе Del Rio-Rodriguez и соавторов у красного горбыля обнаружили ветвящиеся кислотоустойчивые бактерии, которые оказались Nocardia seriolae. Авторы показали их после нескольких вариантов окрашивания, а идентификацию подтвердили молекулярными методами (Del Rio-Rodriguez et al., 2021). Причём Nocardia может сохранять окраску даже после применения Циля–Нильсена — такой результат нельзя автоматически приписывать микобактериям. Но без идентификации нельзя утверждать и обратное: будто большинство крупных палочек непременно относится к нокардиям.\nЦиль–Нильсен выявляет свойство окрашенных структур, а не их родовую принадлежность. Ветвление — повод проверить гипотезу о Nocardia, но не доказательство нокардиоза. Сами по себе гранулёмы, размеры бактерий и «прерывистая» окраска тоже не позволяют выбрать между этими диагнозами.\nА если нет фенола? Фенол входит в состав классического карболового фуксина не потому, что «так принято». Традиционно считается, что он облегчает проникновение красителя через богатую липидами клеточную оболочку микобактерий. Нагревание также способствует окрашиванию.\nНо действительно ли без фенола фуксин не способен проникнуть в бактерию?\nЭтот вопрос уже проверяли экспериментально. Причём задолго до моих опытов и, что особенно интересно, в том числе на возбудителях заболеваний рыб.\nВ 2000 году Vinnie Della Speranza и Rena Fail опубликовали работу с весьма выразительным названием «Phenol Myth Unveiled! Were Ziehl-Neelsen and Kinyoun Mistaken?» — «Миф о феноле раскрыт! Неужели Циль–Нильсен и Киньон ошибались?»\nАвторы сначала пробовали заменять фенол поверхностно-активными веществами. А затем решили проверить, что произойдёт, если убрать и их, оставив только водный раствор основного фуксина.\nРезультат оказался неожиданным: 0,5%-й водный раствор фуксина при нагревании до 60 °C за 15 минут обеспечивал хорошее окрашивание микобактерий. При комнатной температуре тот же раствор оставался неэффективным даже после часа экспозиции. В работе приведены микрофотографии Mycobacterium avium и M. tuberculosis, окрашенных без фенола (Della Speranza \u0026amp; Fail, 2000).\nПолучается, что исключение фенола само по себе не препятствует окрашиванию. Но условия воздействия красителя имеют значение.\nВ 2008 году Carol McCollough проверила этот подход уже непосредственно на возбудителях заболеваний рыб и водных беспозвоночных.\nИсследователь использовала 0,5%-й водный раствор фуксина при 60 °C в течение 15 минут, после чего проводила кислотно-спиртовое обесцвечивание. В препаратах удалось выявить M. marinum в почке золотой рыбки и M. chesapeaki в селезёнке полосатого окуня.\nПричём исследование не ограничивалось микобактериями. Положительное окрашивание получили также для ряда микроспоридий, гаплоспоридий и миксоспоридий. Не все объекты окрашивались одинаково успешно: например, фиксированные споры Kudoa clupeidae не сохранили фуксин после обесцвечивания (McCollough, 2008).\nТо есть метод без фенола уже применяли именно в ихтиопатологической практике — для выявления микобактерий в тканях рыб, в том числе при исследовании селезёнки.\nВ 2020 году Gomes и соавторы провели ещё одно сравнительное исследование, предложив модификацию под названием GASMoC.\nВ отличие от предыдущих опытов, здесь использовали 1%-й водный раствор фуксина при температуре всего 37 °C в течение 15 минут. Препараты окрашивали параллельно: одни — классическим карболовым фуксином, другие — без фенола. В обоих вариантах затем выполняли одинаковое кислотно-спиртовое обесцвечивание.\nИз 12 образцов с ранее установленным туберкулёзом GASMoC позволил обнаружить кислотоустойчивые бактерии во всех 12, тогда как обычный вариант Циля–Нильсена — в 11. Все семь отрицательных контролей остались отрицательными при обеих методиках.\nСтатистически значимого различия между результатами исследователи не обнаружили. При этом палочки после GASMoC нередко окрашивались интенсивнее и лучше различались на фоне тканей.\nВ статье представлены непосредственные сравнительные микрофотографии: один способ с фенолом, другой без него. Кроме того, авторы успешно проверили метод на ткани данио-рерио, содержащей Mycobacterium marinum (Gomes et al., 2020).\nТаким образом, наличие фенола не оказалось обязательным условием выявления кислотоустойчивых бактерий в исследованных препаратах. Изменение состава красителя не привело к утрате диагностически значимого результата.\nИ здесь важно обратить внимание на одну деталь: во всех трёх исследованиях кислотное обесцвечивание сохранялось. Авторы исключали фенол, но продолжали проверять удержание фуксина после кислотной обработки.\nПоэтому речь идёт не просто о возможности увидеть красные палочки без фенола, а о возможности обнаруживать кислотоустойчивые структуры при изменённом составе первичного красителя.\nКонечно, это не означает, что любую методику можно произвольно менять и всегда получать одинаковый результат. Но показывает, что один и тот же диагностический признак может быть выявлен при разных условиях окрашивания.\nЕсли фенол помогает красителю проникать в бактерию, это ещё не означает, что без фенола проникновение невозможно. Вопрос не в обязательности самого реагента, а в том, удаётся ли получить нужный результат без него.\nЕсли фенола нет, вопрос можно поставить не так:\n«Как всё равно сделать вид, что мы выполняем Циль–Нильсена?»\nа так:\nУдастся ли получить достаточное окрашивание интересующих нас структур другим способом?\nВ моих препаратах интенсивное нагревание фуксина без фенола позволяло получить хорошо заметные красные палочковидные бактерии. Это не доказывает, что фенол и нагревание полностью взаимозаменяемы. И такая процедура не становится от этого классической окраской по Цилю–Нильсену. Но для практической задачи произошло важное:\nранее плохо различимые бактерии стали видимыми.\nМы можем оценить их морфологию, количество и расположение в ткани. Это уже полезная информация.\nА если нет кислоты? Здесь граница ещё чётче. Именно кислотное обесцвечивание создаёт тот признак, ради которого метод называется кислотоустойчивым: после жёсткой дифференцировки одни структуры теряют фуксин, а другие сохраняют его. Поэтому если кислотного обесцвечивания не было, нельзя утверждать:\n«Обнаружены кислотоустойчивые бактерии».\nКислотоустойчивость просто не проверялась. Но из этого не следует, что всё сделанное до этого перестаёт иметь смысл. Если в тканевом материале после интенсивного окрашивания становятся отчётливо видны многочисленные палочковидные бактерии, мы уже знаем, что они там есть. Мы видим их форму, плотность скоплений, распределение и отношение к патологически изменённым участкам.\nМы просто не знаем ещё одного свойства — сохранят ли они фуксин после кислотной дифференцировки. И это принципиально разные вещи.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл После интенсивного окрашивания фуксином препарат можно докрасить контрастным красителем. В моём случае использовалась докраска по Леффлеру. Ранее интенсивно окрасившиеся палочки сохраняли ярко-красный цвет.\nТакой контраст позволяет хорошо видеть палочковидные бактерии. Но сам по себе он не является тестом на кислотоустойчивость.\nЭто также не даёт оснований называть все обнаруженные палочки микобактериями: без установления их родовой принадлежности нельзя исключить Nocardia и другие сходные по морфологии бактерии.\nИ здесь возникает ещё одна возможность, которую легко упустить, если считать кислоту обязательной частью любой окраски фуксином. Без кислотного обесцвечивания мы видим не только то, что способно выдержать кислоту. В препарате могут сохраниться окрашенными и другие бактерии, споры, ооцисты паразитов и разнообразные тканевые структуры. Иногда это мешает: фон становится насыщеннее и разбираться в материале труднее. Но иногда именно такая более широкая картина и нужна.\nОтказавшись от кислотного обесцвечивания, мы теряем избирательность по кислотоустойчивости, но можем увидеть то, что этот этап сделал бы незаметным.\nЭто не выдуманный подход. Например, для выявления ооцист Cryptosporidium, Cyclospora и Cystoisospora применяют модифицированные кислотоустойчивые окраски с фуксином. Это паразитические организмы, а не грибы. В стандартных вариантах для них кислотное обесцвечивание обычно не исключают, а изменяют его условия; при этом окраска ооцист может быть неоднородной, и часть их вообще остаётся неокрашенной (CDC, n.d.) (CDC, n.d.).\nДругой пример — бактериальные эндоспоры. В методе Дорнера используют карболовый фуксин с нагреванием, а в одной из модификаций обходятся без отдельного кислотного обесцвечивания. Это уже не окраска на микобактерии, а способ показать другой объект с помощью знакомого красителя (American Society for Microbiology, 2016).\nПоэтому вопрос не всегда в том, как сделать окраску «правильной» для одного возбудителя. Иногда сначала полезнее увидеть больше структур, оценить их форму и расположение, а затем решать, какие из находок требуют специального подтверждения.\nОдин орган — три варианта окрашивания\nДля сравнения я использовал материал одной селезёнки скалярии с многочисленными светлыми очагами.\nЗдесь макрофотография селезёнки.\nИз этого материала были приготовлены препараты, окрашенные тремя способами:\nБез фенола и без кислотного обесцвечивания. Без фенола, но с обесцвечиванием 5%-й серной кислотой. С фенолом и последующим кислотным обесцвечиванием. Во всех случаях использовались один микроскоп и одна камера.\nФенол и кислота Без фенола и кислота Без фенола и кислоты\nРезультат оказался интересным: во всех трёх вариантах хорошо различимы палочковидные бактерии со сходной морфологией. Причём окраска сохранялась и после обработки 5%-й серной кислотой без использования фенола.\nРанее в отдельных опытах я наблюдал сохранение окраски палочек даже после 30 минут обработки 10%-й серной кислотой.\nРазумеется, три препарата одного органа — ещё не полноценное сравнительное исследование чувствительности методик. Но они позволяют непосредственно увидеть, что исключение фенола не обязательно препятствует окрашиванию интересующих нас бактерий.\nИ вот здесь возникает главный вопрос: если нужный результат можно получить при изменении состава реагентов, что именно в методе является обязательным, а что — лишь одним из способов решения задачи?\nЭто не означает, что фенол бесполезен или что все три варианта равноценны. Это означает, что результат можно исследовать, сравнивать и оценивать, а не только сверять с рецептом.\nВот ещё один пример. В другом препарате вместо фуксина используем водный раствор малахитового зелёного, затем проводим кислотное обесцвечивание и докрашиваем флоксином.\nМалахитовый зеленый с прогревом, 5% серная кислота на 2-е минуты, флоксин. Карболовый фуксин, кислотное обесцвечивание\nЕсть сходство в морфологии?\nМалахитовый зеленый, кислота, флоксин. На обоих препаратах видны вытянутые палочковидные структуры, местами образующие характерные скопления. Различаются цвет, контраст и особенности окрашивания, но сходство формы и расположения вполне заметно.\nМы заменили не только фенол, но и сам краситель. При этом интересующие нас морфологические признаки по-прежнему доступны для наблюдения.\nКонечно, сходство изображений не доказывает, что в разных препаратах находятся одни и те же микроорганизмы. Но оно показывает, что полезную морфологическую информацию можно получить разными способами.\nА теперь вопрос: для каждой ли диагностической задачи нам обязательно нужен именно Циль–Нильсен?\nИногда задача — не подтвердить определённое свойство бактерии, а сначала обнаружить подозрительные структуры, рассмотреть их морфологию и понять, что исследовать дальше.\nСможете найти палочковидные структуры без цвета?\nВыберите квадраты, в которых, по вашему мнению, находятся палочковидные структуры. Затем откройте цветную версию. Показать цвет Сбросить А обязательно ли именно такая кислота? Даже история классического метода показывает: важна не «магия» конкретной кислоты, а то, как она обесцвечивает препарат и сохраняется ли при этом окраска интересующих нас структур.\nВ разных вариантах кислотоустойчивой окраски для дифференцировки применяют разные реагенты и концентрации: например, серную кислоту различной концентрации или кислотный спирт с HCl (\rWorld Health Organization, 1982; World Health Organization, 1999). В материалах ВОЗ также упоминалось применение соляной, серной и азотной кислот (World Health Organization, n.d.).\nСмысл кислотной обработки — отделить структуры, которые легко теряют окраску, от тех, которые удерживают фуксин при заданных условиях. Но менять кислоту, её концентрацию и время обработки — не значит автоматически получать тот же диагностический тест.\nОтсюда возникает вполне нормальный экспериментальный вопрос:\nА что будет, если вместо привычного деколоризатора использовать концентрированный раствор лимонной кислоты? Какие структуры потеряют окраску, а какие сохранят?\nЕсли фон обесцвечивается, а некоторые палочки остаются красными, это интересный результат опыта. Но само по себе такое наблюдение ещё не устанавливает их кислотоустойчивость по стандартному критерию.\nВажно: речь об экспериментальной замене реагента, а не о проверенном варианте Циля–Нильсена. В рассмотренных стандартных руководствах лимонная кислота не указана как штатный деколоризатор; сопоставимость результата необходимо проверять на контрольных препаратах.\nПоэтому концентрация здесь — не священная цифра из рецепта. Важны также вид кислоты и время воздействия. При слабой обработке в окружающих тканях может остаться фуксин; если цель — лишь увидеть палочки, это не всегда мешает. При более жёстком обесцвечивании окраску могут терять уже и интересующие нас бактерии. Нужно понимать, что именно выдерживают палочки, а не считать любую сохранившуюся красную окраску доказательством одного и того же свойства.\nЗадача не в том, чтобы найти «правильную» концентрацию кислоты вообще. Задача — понимать, что именно происходит при изменении жёсткости обесцвечивания.\nДаже кислотоустойчивость — не постоянное свойство Микобактерии часто называют кислотоустойчивыми бактериями, будто каждая клетка всегда одинаково удерживает краситель. Но даже внутри одного рода проявление этого признака может изменяться.\nНо это не совсем так.\nVilchèze и Kremer разбирают так называемый «парадокс Коха»: при переходе Mycobacterium tuberculosis в персистирующее, нереплицирующееся состояние часть бактерий может становиться ZN-отрицательной — переставать выявляться стандартной кислотоустойчивой окраской (Vilchèze \u0026amp; Kremer, 2017). Такое состояние часто называют дормантным, или «спящим», хотя это не буквальный сон бактерии.\nЭто связывают с перестройкой липидного обмена и структуры клеточной оболочки. При этом точный механизм потери кислотоустойчивой окраски до конца не установлен: изменение оболочки может как мешать проникновению красителя, так и снижать способность клетки удерживать его после обесцвечивания.\nЗдесь знание о парадоксе Коха превращается в простой практический ход. Представим привычную ситуацию: в селезёнке или почках множество гранулём, картина напоминает микобактериоз, а по Цилю–Нильсену палочки не обнаружены. Что дальше? Можно повторно окрасить материал фуксином, но на этот раз без кислотного обесцвечивания.\nВозможно, появятся те самые неровные, неоднородно окрашенные палочки со знакомой морфологией, которые после кислотной обработки не удавалось увидеть. Мы не доказали, что это микобактерии, но получили новый признак и новое направление для проверки.\nЭто не попытка «исправить отрицательный Циль» любой ценой. Мы просто используем другую возможность окрашивания: сначала посмотреть на морфологию без кислотного отбора, а затем сопоставить находку с тканевыми изменениями. Отсутствие кислоты расширяет круг видимых структур, поэтому одна только похожая форма бактерий не превращается в диагноз.\nРабота Vilchèze и Kremer посвящена прежде всего M. tuberculosis. Это важное основание не считать отрицательный ZN доказательством отсутствия микобактерий, но не повод автоматически объяснять любую ZN-отрицательную гранулёму у рыбы дормантными микобактериями.\nТо есть правильно выполненный Циль–Нильсен отвечает не на вопрос «есть ли здесь микобактерии вообще?», а на более узкий вопрос: «есть ли здесь структуры, которые в данных условиях проявляют кислотоустойчивую окраску?»\nПрактическое следствие довольно важное.\nЕсли палочковидные бактерии сохраняют окраску после кислотной дифференцировки по установленной методике, мы наблюдаем кислотоустойчивость в этих условиях — но ещё не определили их род и вид.\nЕсли при ZN бактерии не обнаружены, это ещё не доказывает, что микобактерий в препарате нет.\nПри персистирующей инфекции часть бактериальной популяции может оставаться невидимой для стандартной кислотоустойчивой окраски, из-за чего бактериальная нагрузка будет недооценена (Vilchèze \u0026amp; Kremer, 2017).\nОкраска показывает не название бактерии, а то, как она ведёт себя при конкретной обработке.\nИ здесь особенно хорошо видно, почему важно понимать границы метода.\nУвидели палочки — знаем, что палочковидные бактерии в ткани есть.\nПровели кислотное обесцвечивание по установленной методике, и палочки сохранили окраску — наблюдаем кислотоустойчивость в этих условиях, но ещё не знаем их род и вид.\nПолучили отрицательный результат по Цилю–Нильсену — ещё не знаем, что микобактерий в ткани нет.\nЧто мы в итоге действительно знаем? Представим препарат, в котором после нагревания с фуксином становятся хорошо различимы многочисленные тонкие красные палочки.\nЕсли морфология позволяет уверенно различать палочковидные бактерии, мы можем описать их присутствие в исследованном материале. Но не всё, что окрашивается фуксином, обязательно является бактерией: в препарате могут быть и другие структуры.\nМы можем оценить:\nих форму и размеры; характер расположения; количество и плотность скоплений; тканевой контекст; связь с гранулематозными или другими патологическими изменениями; повторяемость находки в разных участках материала. Морфология сама по себе, конечно, не определяет род и тем более вид бактерии.\nНо отсутствие полной идентификации не делает наблюдение бесполезным.\nУвидеть бактерии и определить их вид — это разные диагностические задачи.\nТочно так же:\nувидеть окрашенные бактерии и доказать их кислотоустойчивость — тоже разные задачи.\nЕсли нужна следующая ступень уверенности, можно выполнить полноценную кислотоустойчивую окраску, посев, ПЦР или другой подтверждающий метод.\nНо если такой возможности сейчас нет, это не причина делать вид, что микроскоп вообще ничего не показал.\nГде здесь «традиции вместо науки»? Проблема не в стандартной методике.\nСтандартная методика хороша именно тем, что её условия определены, проверены и воспроизводимы.\nПроблема начинается, когда мы перестаём спрашивать, зачем выполняем каждое действие, и просто повторяем знакомый порядок, как ритуал:\n«Без фенола ничего нельзя увидеть».\n«Нужна именно эта кислота, потому что так написано».\n«Если один этап отсутствует, весь результат автоматически равен нулю».\nНаучный подход требует другого вопроса:\nЧто именно изменилось в результате того, что мы изменили метод?\nКогда не понимаешь, что именно показывает окраска, можно даже не догадаться, что стоит проверить материал иначе. Не замечаешь границ своих знаний — не видишь и вопросов, которые ещё нужно задать.\nЕсли убрали кислотное обесцвечивание — потеряли право говорить о кислотоустойчивости, но не обязательно потеряли диагностическую информацию.\nБолее того, можем увидеть структуры, которые после кислоты оставались бы незаметными.\nЕсли изменили условия окрашивания — смотрим, удалось ли получить нужную картину.\nЕсли заменили кислоту — проверяем, какие структуры обесцвечиваются и что результат позволяет утверждать.\nИногда изменение метода сужает круг допустимых выводов, но одновременно расширяет круг того, что мы можем увидеть. Граница проходит не между «правильным» и «неправильным» ритуалом, а между тем, что было проверено, и тем, что мы только предполагаем.\nМетод можно менять. Но вместе с методом меняются и границы допустимых выводов.\nКак описать результат? Если классическая схема не выполнена полностью, прикрываться её названием уже нельзя.\nМожно сказать:\n«Использована модифицированная окраска фуксином с нагреванием без кислотного обесцвечивания. В тканевом материале обнаружены интенсивно окрашенные палочковидные бактерии. Их кислотоустойчивость не оценивалась». Нельзя сказать:\n«Проведена окраска по Цилю–Нильсену; обнаружены кислотоустойчивые бактерии».\nЭто уже разные утверждения.\nЕсли кислотоустойчивость действительно проверена, корректное описание — «обнаружены кислотоустойчивые палочковидные (при наличии — ветвящиеся) бактерии». Заключение «микобактерии» или «нокардии» требует дополнительных оснований.\nВывод Знать границы метода — значит иметь возможность им управлять.\nЕсли метод изменён, не нужно ни выдавать его за стандартный, ни автоматически объявлять полученную информацию бесполезной. Иногда, отказавшись от одного шага, мы теряем диагностическую избирательность, но получаем возможность заметить то, чего не видели прежде.\nНужно сделать более простую вещь:\nточно назвать, что мы сделали, что увидели и что из этого действительно следует.\nЛитература Maekawa, S., Yoshida, T., Wang, P.-C., Chen, S.-C., 2018. Current knowledge of nocardiosis in teleost fish. Journal of Fish Diseases, 41(3), 413–419. Обзор нокардиоза рыб и гранулематозных поражений при инфекции Nocardia. https://doi.org/10.1111/jfd.12782\nBrown-Elliott, B.A., Brown, J.M., Conville, P.S., Wallace, R.J., 2006. Clinical and Laboratory Features of the Nocardia spp. Based on Current Molecular Taxonomy. Clinical Microbiology Reviews, 19(2), 259–282. Описаны ветвящиеся формы, вариабельная кислотоустойчивость и модифицированная окраска с мягким обесцвечиванием. https://doi.org/10.1128/CMR.19.2.259-282.2006\nDel Rio-Rodriguez, R.E. et al., 2021. First evidence of fish nocardiosis in Mexico caused by Nocardia seriolae in farmed red drum (Sciaenops ocellatus, Linnaeus). Journal of Fish Diseases, 44(8), 1117–1130. Рисунок 4: ветвящиеся и неравномерно окрашенные структуры; подтверждение N. seriolae методом ПЦР и секвенированием. https://doi.org/10.1111/jfd.13373\nCenters for Disease Control and Prevention (CDC), n.d. DPDx — Stool Specimens: Staining Procedures.\nОписаны модифицированные кислотоустойчивые окраски для ооцист Cryptosporidium, Cyclospora и Cystoisospora; методы используют фуксин и дифференцирующую обработку, но отличаются от классического Циля–Нильсена.\nhttps://www.cdc.gov/dpdx/diagnosticprocedures/stool/staining.html\nCenters for Disease Control and Prevention (CDC), n.d. DPDx — Cryptosporidiosis.\nИллюстрации ооцист после модифицированной кислотоустойчивой окраски; отмечена вариабельность окрашивания вплоть до практически неокрашенных ооцист.\nhttps://www.cdc.gov/dpdx/cryptosporidiosis/\nAmerican Society for Microbiology (ASM), 2016. Endospore Stain Protocol.\nОписаны варианты окраски бактериальных эндоспор карболовым фуксином, включая модификацию метода Дорнера без отдельного кислотного обесцвечивания.\nhttps://asm.org/ASM/media/Protocol-Images/Endospore-Stain-Protocol.pdf?ext=.pdf\nWorld Health Organization, 1998. Laboratory services in tuberculosis control. Part II: Microscopy. WHO/TB/98.258.\nПриведён рецепт 3%-го кислого спирта: 3 мл концентрированной HCl на 97 мл 95%-го этанола.\nhttps://iris.who.int/bitstream/10665/65942/2/WHO_TB_98.258_%28part2%29.pdf\nWorld Health Organization, 1982. Staining methods for acid-fast bacteria.\nКлассический вариант Ziehl–Neelsen с нагреванием карболового фуксина и деколоризацией 15% серной кислотой.\nhttps://iris.who.int/bitstream/handle/10665/260733/PMC2366253.pdf?isAllowed=y\u0026sequence=1\nWorld Health Organization, 1999. Tuberculosis: a manual for medical students. WHO/CDS/TB/99.272.\nОписаны горячая окраска Циля–Нильсена, кислотно-спиртовая деколоризация и вариант с 25% серной кислотой.\nhttps://iris.who.int/bitstream/handle/10665/68559/WHO_CDS_TB_99.272.pdf\nVilchèze, C., Kremer, L., 2017. Acid-Fast Positive and Acid-Fast Negative Mycobacterium tuberculosis: The Koch Paradox. Microbiology Spectrum, 5(2).\nИстория кислотоустойчивой окраски от Коха до Нильсена и последующих вариантов; также подробно разбираются ZN-отрицательные формы M. tuberculosis, изменения клеточной оболочки и ограничения отрицательного результата окраски.\nhttps://doi.org/10.1128/microbiolspec.TBTB2-0003-2015\nDella Speranza, V., Fail, R., 2000. Phenol Myth Unveiled! Were Ziehl-Neelsen and Kinyoun Mistaken? HistoLogic, 33(2), 21–23. Исследование окрашивания микобактерий водным раствором основного фуксина без фенола. https://sakura-merged.planeteria-development.com/getattachment/f46887f6-b611-4878-8ed0-1de6e1eb0987/434\nMcCollough, C.B., 2008. Application of an aqueous acid-fast staining technique to detect pathogens of aquatic species. Biotechnic \u0026amp; Histochemistry, 83(3–4), 191–197. Применение водного фуксина без фенола для выявления микобактерий и других возбудителей заболеваний рыб и водных беспозвоночных. https://doi.org/10.1080/10520290802450780\nGomes, A., Amaral, P., Santos, R., Santos, S., Tortosa, F., Mendonça, P., Marques-Ramos, A., 2020. GASMoC method: a phenol-free technique to detect acid-fast bacilli. Histochemistry and Cell Biology, 153, 63–69. Сравнение классического метода Циля–Нильсена и модификации без фенола, включая контроль с Mycobacterium marinum в ткани данио-рерио. https://doi.org/10.1007/s00418-019-01825-0\nCaulfield, A.J., Wengenack, N.L., 2016. Diagnosis of active tuberculosis disease: From microscopy to molecular techniques. Journal of Clinical Tuberculosis and Other Mycobacterial Diseases, 4, 33–43. Обзор кислотоустойчивой окраски, гидрофобной клеточной стенки микобактерий, миколовых кислот и устойчивости комплекса красителя к деколоризации.\nhttps://pmc.ncbi.nlm.nih.gov/articles/PMC6850262/\nWorld Health Organization, 1982. General tests / staining procedure for acid-fast bacilli.\nОтмечено, что высокое содержание липидов затрудняет проникновение красителей; для окрашивания используют длительную экспозицию карболового фуксина или нагрев.\nhttps://iris.who.int/bitstream/10665/62463/1/BLG_UNDP_82.1_eng.pdf\nRamos, A. et al., 2019. GASMoC method: a phenol-free technique to detect acid-fast bacilli.\nПример исследования модифицированной фенол-свободной техники выявления кислотоустойчивых бактерий.\nhttps://pubmed.ncbi.nlm.nih.gov/31654127/\nWorld Health Organization, n.d. Ziehl–Neelsen procedure: fundamentals.\nВ документе прямо указано, что для деколоризации могут использоваться разные кислоты, включая соляную, серную и азотную; также описана роль кислотного этапа как регрессивной дифференцировки.\nhttps://applications.emro.who.int/docs/EM_SND_MTG_STR_LEP_CNT_9_3_EN.pdf\n","permalink":"https://fossamethod.ru/ru/posts/index_metod/","summary":"Если часть реактивов недоступна, это не всегда делает исследование бесполезным. Важно понимать функцию каждого этапа, какую информацию он даёт и какой вывод после его исключения уже нельзя делать.","title":"Традиции вместо науки I. Метод. "},{"content":" Глубина разбора F. F.O. F.O.S. FMC: лечение или ритуал? FMC — одна из тех смесей, которые настолько прочно вошли в аквариумную практику, что само её применение иногда воспринимается как достаточное действие.\nРыба чешется — FMC.\nПоявилась слизь — FMC.\nПодозрение на паразитов — FMC.\nНе совсем понятно, что происходит, — тоже FMC.\nПроблема не в самой смеси. Формалин, малахитовый зелёный и метиленовый синий действительно обладают биологической активностью и могут быть полезны в определённых ситуациях\rДве стороны одной дозировки\rЛекарства в аквариумистике: спасение или угроза? Разбираем плюсы и минусы антибиотиков, формалина, метиленовой сини и малахитового зелёного.\r. Проблема начинается тогда, когда из средства против конкретных групп возбудителей FMC превращается в универсальную процедуру: \u0026ldquo;искупать рыбу\u0026rdquo;.\nОткуда вообще взялся FMC? FMC не возник как десятиминутная \u0026ldquo;ванна от всего\u0026rdquo;. В справочнике Геральда Басслера указывается, что предшественником смеси был Leteux–Meyer Mix, предложенный в 1972 году: 3,3 г малахитового зелёного на 1 л формалина (Leteux \u0026amp; Meyer, 1972). В 1979 году G. Bassleer предложил маточный раствор уже из трёх компонентов (Bassleer, 2010):\n3,5 г малахитового зелёного; 3,5 г метиленового синего; 1 л формалина. Рекомендуемая дозировка — 1 мл на 100 л воды, причём одно внесение рассчитано примерно на два дня воздействия. Для ихтиофтириоза предлагалось через два дня заменить воду и повторить обработку (Bassleer, 2010). То есть исходная логика применения FMC — это не несколько минут контакта рыбы с концентрированной смесью, а длительное воздействие сравнительно низкой концентрации препарата в воде.\nДля сравнения, в том же справочнике для одного формалина приведены уже два принципиально разных режима применения (Bassleer, 2010):\n1–2 мл на 100 л воды на 12–48 часов; 0,125–0,25 мл на 1 л воды на 30–60 минут. То есть даже для одного и того же вещества схема лечения определяется не только названием препарата, но и сочетанием концентрации и времени экспозиции. Это важный момент.\nНельзя просто сказать: \u0026ldquo;Формалин применяется против эктопаразитов\u0026rdquo;. Этого недостаточно.\nОдин и тот же формалин может использоваться как длительная обработка в относительно низкой концентрации или как кратковременная ванна в значительно более высокой концентрации. Это уже разные режимы воздействия.\nИменно поэтому фраза: \u0026ldquo;Искупаем рыбу 10 минут в FMC\u0026rdquo; сама по себе почти ничего не говорит о рациональности лечения.\nНужно знать:\nконцентрацию смеси; длительность экспозиции; предполагаемого возбудителя; чувствительность рыбы; условия воды; и главное — откуда вообще взялся именно такой режим. Если в источнике для формалина указаны десятки минут или десятки часов, а для FMC — многодневное воздействие, то десятиминутная ванна FMC требует собственного обоснования.\nНазвание препарата не определяет режим лечения. Режим определяется дозой, временем и задачей.\nСам факт купания ещё ничего не лечит Фраза \u0026ldquo;рыбу искупали в FMC\u0026rdquo; описывает процедуру, но почти ничего не говорит о лечении. Для оценки результата нужно знать хотя бы:\nчто подозревали что было обнаружено до обработки какая использовалась концентрация сколько длилась экспозиция в какой воде проводилась ванна что изменилось после неё сохранился ли предполагаемый возбудитель Без этого FMC легко превращается в действие ради действия. Мы видим, что рыба была помещена в окрашенный раствор на десять минут, и психологически возникает ощущение: лечение проведено. Но лечение определяется не фактом контакта с препаратом, а тем, достигнута ли биологическая цель.\n\u0026ldquo;Если стало лучше — значит сработало\u0026rdquo; Не обязательно.\nПосле ванны рыба может выглядеть лучше по нескольким причинам:\nуменьшилось количество поверхностной слизи; часть эктопаразитов действительно погибла или отделилась; изменилась раздражающая нагрузка на кожу; сама пересадка произошла в более чистую воду; рыба некоторое время меньше контактировала с источником повторного заражения. Ни один из этих вариантов сам по себе не доказывает, какой именно компонент смеси подействовал и что причина заболевания устранена. Тем более улучшение внешнего вида не всегда означает уничтожение возбудителя.\nПроверить свою логику можно Тут : https://fossamethod.ru/ru/test/reasoning-test/\nОтвет на лечение — это наблюдение. Диагноз — это уже интерпретация этого наблюдения.\nЭто не одно и то же.\nА если паразит действительно чувствителен к FMC? Тогда применение смеси может быть вполне оправдано. Но даже здесь остаются вопросы.\nНа какой стадии жизненного цикла чувствителен паразит?\nНаходится ли он на поверхности или глубже в эпителии?\nХватает ли времени экспозиции?\nНе окажется ли лечебная концентрация одновременно слишком тяжёлой для ослабленной рыбы? Особенно сомнительно выглядит короткая ванна, назначенная просто потому, что \u0026ldquo;обычно делаем FMC\u0026rdquo;. Если экспозиция недостаточна для объекта лечения, но достаточна для раздражения жабр и кожи, мы получаем худший вариант:\nпаразит пережил обработку, а рыба — получила дополнительную нагрузку.\nЭто уже не вопрос о том, хороший FMC препарат или плохой. Это вопрос о соответствии метода задаче.\nПочему смесь удобна — и поэтому опасна Смесь из нескольких активных компонентов психологически воспринимается как более надёжная:\n\u0026ldquo;Если один компонент не сработает, сработает другой\u0026rdquo;.\nНо тот же принцип работает и в обратную сторону. Каждый компонент имеет собственную токсичность, собственный спектр действия и собственные ограничения. Поэтому добавление второго и третьего вещества не только расширяет потенциальное действие смеси, но и увеличивает количество факторов, которые мы должны учитывать.\nЧем сложнее смесь, тем меньше смысла использовать её без понимания причины заболевания.\nСамая неудобная ситуация Представим: рыба демонстрирует неспецифическое поведение, например трётся о предметы. Её купают в FMC. Через день поведение уменьшается. Что доказано? Практически ничего. Мы не знаем:\nбыл ли вообще паразит; какой именно; находился ли он на коже или жабрах; повлияла ли на него смесь; какой компонент смеси оказался значимым; не исчезло ли поведение по другой причине. Но именно из таких случаев и рождается традиция:\n\u0026ldquo;При чесании FMC помогает\u0026rdquo;. Через некоторое время исходное наблюдение превращается уже в правило лечения.\nГде здесь \u0026ldquo;традиции вместо науки\u0026rdquo;? Не в том, что FMC старый препарат. И не в том, что его нельзя применять. Проблема начинается тогда, когда название смеси заменяет постановку задачи. \u0026ldquo;Сделать FMC\u0026rdquo; становится самостоятельной целью. Хотя правильный порядок обратный:\nопределить, что мы наблюдаем; сформулировать рабочую гипотезу; понять, на какой объект хотим воздействовать; выбрать препарат и режим воздействия; проверить результат. Если первые три пункта отсутствуют, лечение легко превращается в ритуал.\nПрепарат не становится научно обоснованным только потому, что его применяют много лет.\nНо и старый препарат не становится плохим только потому, что он старый.\nВопрос всегда один: зачем именно мы его применяем здесь и сейчас?\nЛитература Bassleer, G., 2010. Новый иллюстрированный справочник болезней рыб для декоративных тропических и прудовых рыб: наблюдение, диагностика, профилактика, лечение. Пер. Н. О. Лисова. М.: Учебный центр \u0026ldquo;Аква Лого\u0026rdquo;. 232 с. ISBN 978-5-9902638-1-9.\nОсновной источник для приведённой рецептуры FMC, указания на разработку маточного раствора G. Bassleer в 1979 г., дозировки 1 мл/100 л и режимов применения формалина.\nhttps://www.researchgate.net/publication/327941229_New_illustrated_guide_to_fish_diseases\nLeteux, F., Meyer, F.P., 1972. Mixtures of malachite green and formalin for controlling Ichthyophthirius and other protozoan parasites of fish. The Progressive Fish-Culturist, 34(1), 21–26.\nКлассическая работа по смеси малахитового зелёного и формалина для лечения ихтиофтириоза и других протозойных инфекций; в позднейшей литературе именно эта комбинация часто обозначается как Leteux–Meyer mixture.\nhttps://doi.org/10.1577/1548-8640(1972)34%5B21:MOMGAF%5D2.0.CO;2\n","permalink":"https://fossamethod.ru/ru/posts/index_desease/","summary":"FMC может быть полезным препаратом, но сам факт использования ничего не доказывает. Разбираем происхождение смеси, режимы формалина и FMC, связь дозы со временем и то, как лечение превращается в ритуал, если препарат подменяет постановку задачи.","title":"Традиции вместо науки II. Лечение."},{"content":" Глубина разбора F. F.O. F.O.S. \u0026ldquo;Рыбка чешется\u0026rdquo; Само по себе почесывание рыб о камни, грунт или дно — это объективно наблюдаемое поведение. В литературе такое поведение обычно обозначают как flashing или rubbing: рыба резко касается поверхности боком, прокатывается по ней телом, иногда повторяет движение несколько раз. Такое поведение действительно описано при эктопаразитозах и других поражениях кожи и жабр (Garcia et al., 2014) (Maddocks et al., 2016). На этом уровне всё просто: мы видим действие. Проблема начинается дальше — когда действию автоматически приписывается причина.\n\u0026ldquo;Рыбка чешется\u0026rdquo;.\nЗатем:\n\u0026ldquo;Наверное, жабры\u0026rdquo;.\nА затем:\n\u0026ldquo;Значит, паразиты\u0026rdquo;.\nНо насколько хорошо мы вообще умеем определять причину такого поведения по одному только наблюдению?\nПредставим простой эксперимент Проверяющий заранее знает настоящую причину поведения рыбы. Есть две группы. В первой у рыб выраженное раздражение кожных покровов из-за резко неподходящего pH. Во второй — большое количество моногеней на жабрах. В обеих группах рыбы трутся о грунт и декорации. Сам пример с pH не взят с потолка: у радужной форели показаны хемоноцицептивные рецепторы, реагирующие на низкий pH и другие химические раздражители (Mettam et al., 2012). А при моногенеях flashing действительно описывается как клинический признак (Garcia et al., 2014). Наблюдателю показывают только поведение и предлагают ответить:\n\u0026ldquo;В каком случае раздражена кожа, а в каком — жабры?\u0026rdquo;\nИ здесь возникает неудобный вопрос:\n\u0026ldquo;Насколько статистика правильных ответов будет отличаться от случайного угадывания?\u0026rdquo;\nЕсли отличаться будет значительно — значит, существуют специфические особенности поведения, по которым одну причину действительно можно отличить от другой. Тогда их можно описать, проверить и использовать. Но если таких признаков мы назвать не можем, то утверждение:\n\u0026ldquo;Она чешет жабры\u0026rdquo;\nоказывается не наблюдением, а интерпретацией.\nА какие признаки мы вообще используем? Можете ли вы без соскоба, вскрытия и микроскопии уверенно сказать, что именно вызывает почесывание?\nМожете описать:\n\u0026ldquo;как именно отличается почесывание при раздражении кожи от попытки почесать жабры?\u0026rdquo;\nКакая часть тела первой касается поверхности? Как меняется траектория движения? Есть ли характерный поворот головы? Отличается ли частота? Связано ли движение с дыханием? Есть ли специфическая последовательность действий? Если такие различия существуют, их можно исследовать.\nЕсли же ответ сводится к:\n\u0026ldquo;Ну, по рыбе видно\u0026rdquo;, то это уже не диагностический критерий\u0026hellip;это впечатление наблюдателя.\nИ ещё более неудобный вопрос А мы вообще уверены, что рыба может чесать именно жабры? Жабры находятся под жаберной крышкой или внутри жаберной полости и напрямую не контактируют с грунтом или камнем. При внешнем трении рыба может механически воздействовать на область головы, кожу, жаберную крышку, края жаберной щели. Но из самого движения не следует, что она воздействует именно на жаберные лепестки. Возможно, раздражение жабр действительно запускает такую двигательную реакцию. Это вполне правдоподобно и согласуется с описаниями тяжёлых жаберных инвазий моногенеями, при которых наряду с респираторными нарушениями наблюдают и flashing (Garcia et al., 2014). Но сама литература обычно фиксирует наличие такого поведения как клинического признака, а не описывает особую кинематику, позволяющую по одному движению уверенно сказать: \u0026ldquo;рыба чешет именно жабры\u0026rdquo;.\nНо это уже другое утверждение:\n\u0026ldquo;Раздражение жабр может вызывать flashing\u0026rdquo;.\nОно не равно утверждению:\n\u0026ldquo;Рыба чешет жабры\u0026rdquo;.\nПервое описывает связь между раздражением и поведением. Второе предполагает конкретную цель движения. И вот эта цель нам как раз неизвестна.\nА если проверить поведение экспериментально? Допустим, нам удалось точно описать движение: рыба резко поворачивается, касается боком грунта и продолжает плыть. Теперь возникает следующий вопрос: можно ли использовать это движение для выявления заболевания?\nСлово flashing само по себе ничего не доказывает. Оно обозначает определённый тип поведения, а не диагноз. Чтобы признать поведение диагностическим признаком, необходимо установить, насколько часто оно встречается при подтверждённом заболевании, насколько часто — без него и в каких условиях.\nВ 2024 году Bonnichsen и соавторы опубликовали исследование AI-Driven Realtime Monitoring of Early Indicators for Ichthyophthirius multifiliis Infection of Rainbow Trout. Работу включили в январский выпуск Journal of Fish Diseases за 2025 год. Авторы наблюдали за двумя группами радужной форели: одну экспериментально заражали Ichthyophthirius multifiliis, другая служила незаражённым контролем. Рыб снимали видеокамерами до заражения и в течение последующих десяти суток.\nЗадача была практической: найти изменения поведения, которые позволят заметить развитие заболевания как можно раньше. В работе использовали компьютерное зрение, включая детекцию и отслеживание рыб на видео. Однако есть существенная деталь: нейросеть автоматически анализировала прежде всего положение и перемещения рыб, а эпизоды трения о предметы и резкие рывки отдельно оценивали наблюдатели по выборкам видеозаписей. Называть эти два типа анализа одним «машинным распознаванием почесывания» было бы неправильно.\nИ что получилось?\nПервое. Резкие, внезапные ускорения (spikes) наблюдались как до заражения, так и после него. Они встречались и у незаражённых, и у инфицированных рыб. Авторы отмечают, что подобные движения возможны не только при раздражении покровов: их могут вызывать взаимодействия с другими рыбами или внешние события. Следовательно, сам по себе резкий рывок оказался недостаточно специфичным признаком инфекции.\nВторое. Непосредственное трение или «почёсывание» о предметы (rubbing/scratching) при просмотре записей обнаруживали лишь несколько раз. На фоне экспериментально подтверждённого заражения такое поведение оказалось малопригодным для раннего обнаружения заболевания. При этом авторы осторожно указывают на ограничение: рыбы могли скрываться за искусственными растениями и оборудованием, что затрудняло регистрацию некоторых движений.\nТретье. Более информативным оказалось совсем другое изменение: заражённые рыбы уже на ранних этапах чаще перемещались в области аквариума с более сильным течением. Авторы связывают это, в качестве гипотезы, с нарушением жаберной функции и попыткой компенсировать затруднённое дыхание. Но даже этот результат не означает, что перемещение к течению специфично именно для ихтиофтириоза: исследование проверяло поведение рыб в конкретной экспериментальной системе.\nЗдесь важно не приписывать статье того, чего в ней нет. Авторы не доказали, что здоровые рыбы регулярно трутся о грунт. Они показали, что резкие рывки встречаются в том числе у здоровых рыб, а собственно трение в их эксперименте наблюдалось редко и не стало надёжным ранним индикатором инфекции.\nПризнак заболевания — или пригодный диагностический тест? Это разные понятия.\nРыба может тереться о предметы при паразитарном поражении. Но отсюда ещё не следует, что такое поведение позволяет надёжно выявлять паразитоз, исключать его при отсутствии трения или устанавливать локализацию поражения.\nДля диагностического теста важны как минимум две характеристики:\nЧувствительность: как часто признак обнаруживается у рыб, у которых заболевание действительно есть. Если заражённые рыбы редко демонстрируют такое поведение, множество случаев останется незамеченным. Специфичность: как часто признак отсутствует у рыб без данного заболевания. Если сходные движения возникают по другим причинам, положительное наблюдение может вводить в заблуждение. Для flashing нельзя автоматически подставлять в эти определения результаты по spikes: трение о поверхность и резкий рывок — не один и тот же поведенческий критерий. Более того, приведённое исследование не даёт достаточных данных для расчёта универсальных показателей чувствительности и специфичности «почёсывания». Оно демонстрирует ограничения выбранных поведенческих индикаторов в конкретных условиях.\nДаже если в дальнейшем будет установлено, что рыбы с определённым поражением трутся чаще здоровых, потребуется уточнить: насколько чаще, при каких условиях, у каких видов и где проходит граница между обычным и подозрительным поведением. Статистическая связь ещё не является диагностическим правилом для отдельной рыбы.\nЧто пришлось бы доказать, чтобы фраза «чешет жабры» стала критерием? Вернёмся к мысленному эксперименту с раздражением кожи и поражением жабр.\nМожно записать поведение обеих групп на видео, заранее определить измеримые параметры движения и предложить независимым наблюдателям — не знающим результатов обследования — различить причины. В качестве независимой проверки нужны данные о состоянии покровов и жабр, микроскопии соскобов и жаберного материала, а также параметры среды. Далее можно сравнить ответы наблюдателей с подтверждёнными находками, подсчитать ошибки и проверить, воспроизводятся ли результаты на других рыбах.\nНо даже здесь есть ловушка. Если признаки придуманы после просмотра видео, по которому затем оценивается их точность, получится скорее подгонка объяснения, чем независимая проверка. Определения движения и правила классификации необходимо зафиксировать до проверки на отдельной выборке.\nТак можно исследовать, существует ли вообще характерная кинематика, связанная именно с жаберным раздражением. Пока же слова «трётся боком» описывают то, что доступно наблюдению, а слова «чешет жабры» дополнительно предполагают механизм и цель действия, которые ещё не установлены.\nНаличие признака при болезни не делает его специфичным для болезни. Отсутствие признака не исключает болезнь. А привычное название движения не превращает предположение о его причине в факт.\nИменно здесь граница проходит не между «опытным» и «неопытным» наблюдателем, а между наблюдением, проверяемой гипотезой и подтверждённым диагностическим выводом.\nГде заканчивается наблюдение? Можно сказать:\n\u0026ldquo;Рыба совершает повторяющиеся резкие боковые контакты с грунтом\u0026rdquo;.\nМожно сказать:\n\u0026ldquo;Такое поведение часто обозначают как flashing и связывают с раздражением кожи или жабр\u0026rdquo; (Garcia et al., 2014) (Maddocks et al., 2016).\nНо фразы:\n\u0026ldquo;У неё зуд\u0026rdquo;. \u0026ldquo;Она чешет жабры\u0026rdquo;. \u0026ldquo;Это моногенеи\u0026rdquo;.\n— уже находятся на разных уровнях интерпретации.\nИ каждый следующий уровень требует дополнительных признаков.\nМы наблюдаем поведение. Причину этого поведения ещё нужно доказать.\nЛитература Garcia, R.L., Hansen, A.G., Chan, M.M., Sanders, G.E., 2014. Gyrodactylid Ectoparasites in a Population of Rainbow Trout (Oncorhynchus mykiss). Journal of the American Association for Laboratory Animal Science, 53(1), 92–97.\nКлинический случай гиродактилидной инвазии у радужной форели. Авторы описывают erratic swimming и flashing; также указывают, что гиродактилиды поражают поверхностные слои кожи и жабр и могут вызывать раздражение, гиперплазию эпителия, гиперсекрецию слизи и pruritus, который интерпретируется по flashing.\nhttps://pmc.ncbi.nlm.nih.gov/articles/PMC3894654/\nMettam, J.J., McCrohan, C.R., Sneddon, L.U., 2012. Characterisation of chemosensory trigeminal receptors in the rainbow trout, Oncorhynchus mykiss: responses to chemical irritants and carbon dioxide. Journal of Experimental Biology, 215(4), 685–693. https://doi.org/10.1242/jeb.060350\nЭкспериментальная работа по химически чувствительным рецепторам у радужной форели. Показана реакция на потенциально повреждающие химические стимулы, включая низкий pH, уксусную и лимонную кислоты. Это подтверждает физиологическую возможность выраженного кожного раздражения без участия паразита.\nhttps://pubmed.ncbi.nlm.nih.gov/22279076/\nMaddocks, C.E. et al., 2016. Puffy Skin Disease Is an Emerging Transmissible Condition in Rainbow Trout Oncorhynchus mykiss Walbaum. PLOS ONE, 11(7), e0158151.\nВ эксперименте при заболевании с выраженным поражением кожи у форели наблюдали flashing: рыбы опускались к дну, тёрлись боками о поверхность и быстро выпрямлялись. Хороший пример того, что сходное поведение возникает при кожной патологии и само по себе не указывает на жаберную локализацию.\nhttps://pmc.ncbi.nlm.nih.gov/articles/PMC4938586/\nBonnichsen, R., Nielsen, G. G. B., Dam, J. S., Schrøder-Petersen, D., Buchmann, K. (2025). AI-Driven Realtime Monitoring of Early Indicators for Ichthyophthirius multifiliis Infection of Rainbow Trout. Journal of Fish Diseases, 48(1), e14027. Опубликовано онлайн 30.09.2024. https://doi.org/10.1111/jfd.14027\n","permalink":"https://fossamethod.ru/ru/posts/index_fish_scrab/","summary":"Flashing — наблюдаемое поведение, а «зуд», «раздражение жабр» и «паразиты» — уже объяснения. Разбираем, что именно можно увидеть, какие выводы действительно следуют из поведения рыбы и где привычная формулировка превращается в недоказанную причинную модель.","title":"Традиции вместо науки III. Интерпретация."},{"content":"\nГлубина разбора F. F.O. F.O.S. Две селезёнки. Один диагноз? Перед нами два снимка селезёнок рыб. На обеих — множество беловатых точек и узелков. Внешне картины похожи.\nЧеловек, который уже встречался с заболеваниями рыб, может предположить: «Микобактериоз». Или, по привычке, сказать ещё проще: «Рыбий туберкулёз».\nТакое предположение не возникает на пустом месте. При микобактериозах действительно нередко встречаются узелковые поражения органов. Но похожая картина ещё не означает одинаковую причину.\nПосмотрим, что обнаружилось в этих двух случаях.\nСелезёнка рыбы с множественными беловатыми очагами. При микроскопии выявлены микобактерии. Селезёнка рыбы с множественными беловатыми узелками. В микроскопическом препарате обнаружены другие внутриклеточные микроорганизмы. Вот и вся неожиданность: снаружи похоже — под микроскопом находки разные. Увидев только белые точки, мы не могли заранее знать, что обнаружим внутри.\nА что такое гранулёма? Иногда на вскрытии видны светлые узелки, а при исследовании тканей под микроскопом — особые скопления защитных клеток. Их называют гранулёмами.\nОдна из задач этих клеток — захватывать и убирать то, что организму мешает. Они могут поглощать бактерии, остатки погибших клеток и другой материал. Но не всё удаётся быстро разрушить и удалить.\nКогда проблема сохраняется, защитные клетки способны собираться вокруг неё и образовывать организованный очаг. Так может возникнуть гранулёма.\nВажное уточнение: не каждый белый узелок, замеченный при вскрытии, уже является доказанной гранулёмой. Чтобы назвать образование гранулёмой, нужно оценить его строение, а не только цвет и форму снаружи.\nПочему гранулёма не указывает на одного виновника Представь, что в ткани обнаружили такое скопление клеток. Что оно означает?\nВозможно, организм пытается сдержать бактерии. Но причиной может быть и другой микроорганизм, паразит, посторонняя частица или собственный материал разрушенных тканей, который долго не удаётся убрать.\nТо есть гранулёма показывает, как организм реагирует на проблему, но не сообщает её название.\nЭто немного похоже на следы работы ремонтной бригады. По тому, что вокруг места собрались рабочие, понятно: здесь что-то произошло. Но нельзя без осмотра решить, сломалась труба, проводка или стена.\nС гранулёмой ещё интереснее: иногда при определённых инфекциях скопление защитных клеток не только ограничивает возбудителя, но и может создавать ему условия для дальнейшего распространения. Поэтому даже число и внешний вид гранулём не позволяют просто пересчитать бактерии.\nА если нашли красные палочки? Для проверки подозрения на микобактериоз можно использовать специальную окраску препарата. После обработки красителем и кислотой некоторые бактерии остаются красными. Такое свойство называют кислотоустойчивостью.\nЕсли в поражённой ткани видны соответствующие палочковидные бактерии, подозрение на микобактериоз становится более обоснованным. Но цвет ещё не говорит, какой именно это вид бактерии. Для уточнения могут понадобиться другие исследования.\nИ наоборот: если при окрашивании кислотоустойчивые бактерии не обнаружили, это не означает, что все возможные причины поражения окончательно исключены.\nСамо окрашивание и его ограничения мы отдельно разбираем в статье «Традиции вместо науки I. Метод».\nЧто в итоге писать в заключении? Сначала — то, что действительно установлено.\nЕсли при вскрытии видны только беловатые узелки, их можно так и описать. Если микроскопия подтвердила гранулёматозное строение, можно написать: «множественные гранулёмы».\nА фраза «микобактериоз» потребует собственных оснований.\nПохожая форма, белый цвет, наличие некроза или большого количества узелков сами по себе не заменяют поиск причины.\nГранулёма — не диагноз. Это след работы организма. А задача диагностики — выяснить, из-за чего эта работа понадобилась.\nЕсли хочется разобраться глубже: F.O. — как формируется гранулёма и что показывает морфология · F.O.S. — полный разбор с микропрепаратами и источниками.\n","permalink":"https://fossamethod.ru/ru/f/index_granulomas/","summary":"Две похожие селезёнки, разные находки под микроскопом. История о том, почему белые узелки и гранулёмы ещё не диагноз.","title":"Белые точки в органах рыбы. Это туберкулёз?"},{"content":"\nГлубина разбора F. F.O. F.O.S. «Нашли гранулёмы — значит, микобактериоз» При вскрытии рыб беловатые узлы в селезёнке, печени или почках часто вызывают подозрение на микобактериоз. Оно обоснованно: гранулематозные поражения действительно характерны для многих случаев микобактериальной инфекции. Ошибка возникает в следующем шаге — когда морфологическую находку принимают за уже установленную этиологию.\nЗдесь следует развести три понятия: видимый узелок, гранулёма и микобактериоз. Они связаны, но не равнозначны.\nЧто мы действительно видим? На двух фотографиях селезёнок рыб заметны многочисленные беловатые очаги. Макроскопически картины сходны, но результаты микроскопии различаются.\nСелезёнка рыбы с множественными беловатыми очагами. При микроскопии выявлены микобактерии. Селезёнка рыбы с множественными беловатыми узелками. В микроскопическом препарате обнаружены другие внутриклеточные микроорганизмы. По цвету и распределению видимых очагов нельзя восстановить их клеточное строение. Поэтому белый узелок при вскрытии не следует автоматически называть гранулёмой. Сначала нужна оценка ткани, например гистологическое исследование.\nИз чего состоит гранулёма и зачем она образуется В классическом определении гранулёма — организованное скопление зрелых мононуклеарных фагоцитов, прежде всего макрофагов. Это клетки, которые захватывают и перерабатывают микроорганизмы, чужеродные частицы и остатки повреждённых тканей. В гранулёме могут присутствовать другие клетки, а в центре — некроз, но эти признаки не обязательны для самого определения (Pagán \u0026amp; Ramakrishnan, 2018).\nЕсли макрофаг способен устранить раздражитель, длительной организованной реакции может не возникнуть. Но когда материал сохраняется, плохо разрушается или слишком велик, привлекаются новые клетки и формируется локальный очаг.\nВажно, что сохраняющийся материал не обязательно поступил извне. Реакция возможна в том числе на собственные тканевые остатки после повреждения. Поэтому схема «гранулёма = инфекция» неверна уже на уровне механизма.\nСами гранулёмы могут возникать при разных бактериальных, грибковых и паразитарных поражениях, а также при некоторых неинфекционных процессах. Гранулематозный ответ характеризует реакцию хозяина; этиология устанавливается отдельно.\nПочему форма и некроз не дают готового диагноза При изучении гранулёматозных очагов обращают внимание на их организацию, размер, количество, наличие некроза, выраженность периферических клеточных слоёв и соединительнотканной капсулы.\nВ исходном разборе приведена удобная схема с одним компактным центром, крупным неправильным центром и близко расположенными очагами, которые могут сливаться. Это модель возможных вариантов организации, а не способ по очертанию точно распознать возбудителя.\nУсловная схема факторов, влияющих на вид гранулематозных очагов. Некроз — гибель клеток внутри очага — действительно встречается при микобактериозах, но не является их исключительным признаком. Отсутствие некроза тоже не исключает микобактериальную инфекцию. То же относится к выраженности капсулы и правильности контуров.\nВ пределах одной группы рыб сходные поражения могут приобретать похожее строение. Это полезно для сравнения случаев и выдвижения гипотезы об общем процессе, но не делает определённую форму гранулёмы уникальной для отдельного возбудителя.\nНе всякое круглое образование — гранулёма В исходной статье показаны образования в почках неона, предположительно минеральные конкременты; вокруг некоторых видны структуры, напоминающие гранулематозную реакцию. Показаны также фиброзные узловые образования в почках пескаря. Описание этих находок намеренно осторожное: без дополнительного подтверждения не следует приравнивать каждый узелок или похожую клеточную структуру к определённому патологическому процессу.\nПосмотреть эти препараты в интерактивном микроскопе F.O.S..\nМного гранулём — значит, высокая бактериальная нагрузка? Не обязательно. Количество и сохранность гранулём определяются не только возбудителем, но и тем, как организован иммунный ответ. Хорошо сформированные очаги могут ограничивать инфекцию. При нарушенной организации реакции возможно интенсивное размножение микобактерий на фоне разрушения гранулём.\nБолее того, экспериментальные модели Mycobacterium marinum у данио показали, что микобактерии в определённых условиях используют привлечение и перемещение макрофагов для дальнейшего распространения (Pagán \u0026amp; Ramakrishnan, 2015).\nТаким образом, гранулёма — не всегда неподвижная капсула вокруг возбудителя и не «счётчик» бактериальных клеток.\nКак перейти от находки к этиологическому диагнозу Удобно разделять уровни доказательности.\nМакроскопия. Видны беловатые узелки или очаги в определённых органах. Это описание внешних изменений, а не установление их клеточного состава. Микроскопия тканей. Оцениваем, подтверждается ли гранулематозное строение, что находится в центре очага, есть ли некроз и другие изменения. Специальная окраска. После окраски по Цилю–Нильсену можно искать структуры, сохраняющие краситель после кислотного обесцвечивания. Их обнаружение, особенно в очагах поражения, усиливает подозрение на микобактериоз. Однако кислотоустойчивость не определяет вид бактерии, а отрицательная окраска сама по себе не исключает инфекцию. Уточнение возбудителя. При необходимости применяют культуральное исследование, ПЦР, секвенирование или сочетание методов с учётом качества материала и клинического контекста. Подробнее о том, что именно проверяет окраска: «Традиции вместо науки I. Метод».\nЭта последовательность не означает, что в каждом случае доступны все исследования. Она нужна, чтобы понимать, на каком уровне достоверности остановилось наше заключение.\nГде проходит граница «В органах обнаружены множественные беловатые очаги» — макроскопическое наблюдение.\n«В ткани подтверждены гранулёмы» — морфологическое заключение.\n«Выявлены кислотоустойчивые палочковидные бактерии» — результат специального исследования.\n«Установлен микобактериоз» — этиологический диагноз, требующий оценки совокупности данных.\nПереход между этими формулировками должен происходить по мере появления доказательств, а не потому, что они часто встречаются вместе.\nГранулёма позволяет охарактеризовать патологический процесс. Но не позволяет по одному только своему виду назвать его причину.\nЛитература Pagán, A. J., Ramakrishnan, L. (2018). The Formation and Function of Granulomas. Annual Review of Immunology, 36, 639–665. https://doi.org/10.1146/annurev-immunol-032712-100022 Pagán, A. J., Ramakrishnan, L. (2015). Immunity and Immunopathology in the Tuberculous Granuloma. Cold Spring Harbor Perspectives in Medicine, 5, a018499. https://doi.org/10.1101/cshperspect.a018499 Полезные версии: F. — история двух селезёнок без сложных терминов · F.O.S. — полный текст, примеры и микроскопические коллекции.\n","permalink":"https://fossamethod.ru/ru/fo/index_granulomas/","summary":"Макроскопический узелок ещё не гранулёма, а гранулёма ещё не микобактериоз. Объясняем механизм, морфологические признаки и этапы проверки диагноза.","title":"Гранулёмы у рыб: что показывает строение и чего оно не доказывает"},{"content":"\nГлубина разбора F. F.O. F.O.S. Когда красные палочки важнее названия метода Окраска по Леффлеру Окраска по Цилю — Нильсену Простым окрашиванием микобактерии не выявляются.\nПредставьте: вы смотрите в микроскоп на ткань больной рыбы. Видите клетки, какие-то пятна, обломки тканей. Но есть ли среди всего этого бактерии? Непонятно.\nВ обычной лаборатории для таких случаев существуют специальные окраски. Краситель помогает выделить то, что почти невозможно различить в бесцветном препарате.\nВ нашем случае мы используем фуксин — краситель, который придаёт некоторым клеткам и бактериям ярко-красный цвет. Благодаря этому под микроскопом становятся заметны структуры, которые без окрашивания трудно различить. В классическом методе к фуксину добавляют фенол — химическое вещество, которое само ничего не окрашивает, но помогает красителю проникать в трудно окрашиваемые структуры бактерий. Такая смесь называется карболовым фуксином. Важен и нагрев. При обычной окраске по Цилю–Нильсену краситель осторожно прогревают до появления лёгких паров — ориентировочно до 60 °C. Кипятить его не нужно. Тепло помогает фуксину окрашивать бактерии, но это не значит, что чем горячее, тем лучше.\nПосле окрашивания препарат обрабатывают кислотой. Она удаляет краситель из многих структур, но некоторые бактерии сохраняют красную окраску. Именно так проверяют их кислотоустойчивость — способность удерживать краситель после обработки кислотой.\nТолько вот нужные реактивы есть не всегда. И что тогда — убрать препарат и признать, что узнать ничего нельзя?\nХочется проверить другое: что можно увидеть, если изменить привычный способ окрашивания? И главное — что после этого можно честно сказать о результате?\nОдна скалярия и три препарата Возьмём селезёнку скалярии с многочисленными светлыми точкими. Приготовим из этого материала препараты и окрасим их тремя способами.\nВ первом случае используем привычную схему: специальный краситель с фенолом, а затем кислоту. Во втором — уберём фенол, но оставим обработку кислотой. В третьем — не используем ни фенол, ни кислотное обесцвечивание.\nЗачем всё это? Не ради нового названия для старого метода. Мы увидим, насколько важен каждый его этап.\nРезультат оказался наглядным. Во всех трёх вариантах хорошо заметны небольшие красные палочки, похожие по форме и расположению. Для сравнения используем один микроскоп и одну камеру.\nКрасные палочковидные бактерии: окраска с фенолом и кислотой. Красные палочковидные бактерии: окраска без фенола, но с кислотой. Красные палочковидные бактерии: окраска без фенола и без кислотного обесцвечивания. Это не большое научное исследование, а сравнение нескольких препаратов из одного органа. По таким снимкам нельзя объявить три способа одинаково надёжными. Но они показывают одну полезную вещь: если изменить рецепт, результат не обязательно исчезнет.\nПочему кислоту нельзя просто вычеркнуть Здесь есть важная тонкость.\nНекоторые бактерии способны сохранять красную окраску даже после обработки кислотой. Это свойство называют кислотоустойчивостью. Именно его проверяет известный лабораторный метод Циля–Нильсена.\nЕсли кислотой препарат не обрабатывали, проверка не состоялась. Пусть палочки выглядят совершенно так же, как в другом препарате, — мы не имеем права назвать их кислотоустойчивыми только по цвету.\nНо разве это означает, что увиденные палочки бесполезны? Нет. Мы по-прежнему можем рассмотреть их форму, количество, расположение и то, в каких участках ткани они встречаются.\nПолучается простая разница:\nУвидеть бактерии — одна задача. Проверить их кислотоустойчивость — другая. Определить, какие именно это бактерии, — третья.\nОдна фотография не решает все три задачи сразу.\nА фенол зачем? Фенол входит в состав привычного красителя и помогает окрашиванию. Но «помогает» не означает «без него невозможно».\nИсследователи уже показывали, что при определённых условиях бактерии можно окрашивать фуксином без фенола. И здесь неожиданно важной оказалась температура. Например, водный фуксин успешно применяли при 60 °C в течение 15 минут, в том числе на тканях рыб (\rMcCollough, 2008). А в другом исследовании обошлись всего 37 °C за те же 15 минут, изменив концентрацию красителя (\rGomes и соавт., 2020). В обоих случаях последующее кислотное обесцвечивание сохраняли.\nПолучается, вопрос «до 40, до 60 или до кипения?» нельзя решить одной цифрой. Результат зависит также от состава раствора и времени окрашивания. Температура 37 °C была проверена в конкретной методике; это не доказательство, что всякая окраска сработает при 40 °C. А кипячение вовсе не требуется.\nТо есть вопрос не в том, хорош фенол или плох. Вопрос в том, какую работу он выполняет и можно ли добиться нужного результата иначе.\nПочему это важно Когда занимаешься диагностикой, иногда не хватает не только реактивов, но и времени, оборудования или возможности сразу отправить образец в лабораторию.\nВ такой ситуации легко впасть в одну из двух крайностей. Первая: «Ничего нельзя сделать правильно, значит, ничего и не будем смотреть». Вторая: «Вижу красные палочки — значит, диагноз установлен».\nОбе мешают думать.\nМикроскоп может дать полезную информацию даже тогда, когда окончательный ответ пока недоступен. Нужно только не приписывать увиденному больше, чем оно доказывает.\nМетод можно изменить. Но тогда надо заново спросить себя: \u0026ldquo;что я действительно проверил, что увидел и чего пока не знаю?\u0026rdquo;\nВ этом и заключается разница между работой по инструкции и пониманием того, зачем эта инструкция существует.\nЕсли хочется разобраться глубже: почему окраска работает и где проходят границы выводов или полный разбор с историей метода, опытами и источниками.\n","permalink":"https://fossamethod.ru/ru/f/index_metod/","summary":"Можно ли получить полезную информацию из препарата, когда нет всех реактивов? История одного опыта и трёх окрашиваний.","title":"Красные палочки: зачем я изменил привычный метод"},{"content":"\nГлубина разбора F. F.O. F.O.S. Если изменить окраску, что останется от результата? В диагностике есть соблазн воспринимать методику как набор обязательных действий. Не оказалось одного реагента — значит, выполнить метод нельзя и препарат уже ничего не расскажет.\nНо здесь смешиваются два вопроса: можно ли провести стандартный тест и можно ли получить из препарата полезное наблюдение. Ответы на них не всегда совпадают.\nХороший пример — окраска по Цилю–Нильсену, которую применяют для выявления кислотоустойчивых бактерий, в том числе микобактерий. В классических вариантах используют карболовый фуксин, нагревание, кислотное или кислотно-спиртовое обесцвечивание и контрастную окраску. Каждый этап выполняет свою функцию.\nЕсли какой-то этап изменить, нужно понять, какую информацию мы сохранили, а какую потеряли.\nЧто происходит при окрашивании Окраска по Леффлеру Окраска по Цилю — Нильсену Простым окрашиванием микобактерии не выявляются.\nФуксин окрашивает структуры препарата. Фенол и нагревание в классическом варианте способствуют проникновению красителя, в том числе в бактерии, которые плохо окрашиваются обычными способами.\nЗатем наступает принципиально другой этап: обработка кислотой. Она удаляет краситель из одних структур, тогда как другие продолжают удерживать его в заданных условиях. Именно так выявляют кислотоустойчивость — способность сохранить окраску после определённой обесцвечивающей обработки.\nКонтрастный краситель помогает различать ткани и фон.\nЗначит, исключение фенола и исключение кислоты — не равноценные изменения. В первом случае мы меняем условия первичного окрашивания. Во втором — убираем саму проверку кислотоустойчивости.\nНагревание: 40, 60 градусов или до кипения? В классическом методе Циля–Нильсена нагревают уже нанесённый на препарат карболовый фуксин, обычно до начала появления паров. В некоторых руководствах этот ориентир связывают приблизительно с 60 °C. Краситель выдерживают нагретым несколько минут (часто 3–5 минут), не давая ему закипеть или высохнуть (\rпротокол ASM; сравнительное исследование).\nНо появление паров — это не кипение: жидкость испаряется и при меньших температурах. Поэтому «до паров» служит лишь приблизительным ориентиром, а не точным способом контроля нагрева. Для воспроизводимой модификации лучше фиксировать измеренную температуру красителя, время выдержки и его концентрацию.\nПочему же не нагреть сильнее? Кипячение не входит в цель метода: оно ускоряет испарение, может привести к высыханию и разбрызгиванию красителя. При использовании фенола это ещё и вопрос химической безопасности. Отдельно следует различать термофиксацию препарата до окрашивания и нагревание красителя во время окрашивания — это разные операции.\nУ фенол-свободных вариантов режим иной. В одних исследованиях брали 0,5%-й водный фуксин при 60 °C на 15 минут; в методе GASMoC — 1%-й водный фуксин при 37 °C на 15 минут. Следовательно, работа при 37–40 °C в принципе возможна, но 40 °C не является универсальной проверенной температурой: каждый режим нужно оценивать вместе с концентрацией красителя, экспозицией и типом препарата. Эти результаты относятся к конкретным исследованиям, а не устанавливают взаимозаменяемость всех условий.\nМожно ли обойтись без фенола? Да, при определённых условиях. Это подтверждается исследованиями, а не только отдельными наблюдениями.\nDella Speranza и Fail (2000) показали, что 0,5%-й водный раствор основного фуксина без фенола способен окрашивать микобактерии при 60 °C за 15 минут. При комнатной температуре в их условиях тот же подход работал значительно хуже. Следовательно, важен не только состав, но и режим воздействия красителя (\rработа 2000 года).\nMcCollough (2008) применила окрашивание 0,5%-м водным фуксином при 60 °C за 15 минут при исследовании возбудителей заболеваний водных животных, включая Mycobacterium marinum в почке золотой рыбки (\rисследование).\nGomes и соавторы (2020) сравнили стандартную и модифицированную фенол-свободную окраску с применением 1%-го водного фуксина при 37 °C в течение 15 минут на клинических образцах и на ткани данио-рерио с M. marinum. В исследованной выборке новая схема не уступала стандартной по обнаружению кислотоустойчивых бактерий; однако выборка была небольшой, и переносить этот результат на любые материалы и условия нельзя (\rисследование GASMoC).\nВо всех этих случаях важно одно: кислотное обесцвечивание сохраняли. Авторы меняли первичный краситель, но не отказывались от проверки того признака, ради которого проводят тест.\nТаким образом, отсутствие фенола само по себе не делает выявление кислотоустойчивых бактерий невозможным. Но конкретный вариант окраски должен иметь проверенные условия и контроль результата.\nЧто происходит, если убрать кислоту? Предположим, после интенсивного окрашивания фуксином в ткани видны красные палочковидные бактерии. Можно рассмотреть их форму, примерное количество, распределение и связь с изменёнными участками органа.\nНо если кислотного обесцвечивания не было, кислотоустойчивость не исследовалась. Здесь уже нельзя написать «выявлены кислотоустойчивые бактерии», как бы убедительно они ни выглядели.\nУ такого изменения есть и обратная сторона. Кислота может убирать окраску не только с фона, но и со структур, которые было бы интересно увидеть. Без неё поле зрения может стать более «грязным», зато сохранятся дополнительные объекты. Это удобно для поискового наблюдения, но снижает избирательность метода.\nПоэтому окраска без кислотного обесцвечивания — не упрощённый Циль–Нильсен. Это другая процедура с другим кругом допустимых выводов.\nОдин орган — три способа Для собственного сравнения я использовал препараты одной селезёнки скалярии с многочисленными светлыми очагами. Их окрашивали по трём схемам:\nС фенолом и последующим кислотным обесцвечиванием. Без фенола, но с обесцвечиванием 5%-й серной кислотой. Без фенола и без кислотного обесцвечивания. Все препараты снимались на одном микроскопе с одной камерой.\nПалочковидные бактерии при окраске с фенолом и кислотным обесцвечиванием. Палочковидные бактерии при окраске без фенола с кислотным обесцвечиванием. Палочковидные бактерии при окраске без фенола и кислоты. Во всех трёх случаях наблюдались сходные красные палочковидные бактерии. Это согласуется с возможностью окрашивания без фенола, в том числе с сохранением окраски после обработки кислотой.\nОднако препараты одного органа не позволяют рассчитать чувствительность, специфичность или доказать равноценность трёх схем. Это сравнение наблюдаемых результатов, а не валидация новой диагностической методики.\nА если использовать другую кислоту? В исторических и современных вариантах кислотоустойчивой окраски применяли разные кислоты и режимы обесцвечивания. Поэтому одна конкретная кислота не является универсальной и незаменимой частью всех вариантов метода (\rобзор Vilchèze и Kremer, 2017).\nНо из этого не следует, что любой кислый раствор даёт одинаковую проверку. Вид кислоты, концентрация и продолжительность обработки влияют на то, какие структуры потеряют окраску.\nНапример, концентрированный раствор лимонной кислоты можно рассматривать как экспериментальный деколоризатор. Даже если фон обесцветился, а палочки остались красными, такой результат ещё не равнозначен стандартному тесту. Для сравнения потребуются подходящие положительные и отрицательные контрольные препараты.\nОтрицательная окраска тоже имеет границы Есть ещё одна причина не превращать результаты окраски в окончательный диагноз.\nДаже микобактерии не всегда демонстрируют одинаковую кислотоустойчивость. У Mycobacterium tuberculosis описаны состояния, при которых часть клеток плохо выявляется или не выявляется обычным способом. Это обсуждается в работе о так называемом «парадоксе Коха» (\rVilchèze и Kremer, 2017).\nДля диагностики рыб отсюда следует осторожный принцип: отрицательная окраска сама по себе не доказывает отсутствие микобактерий. Но нельзя и объяснять любую отрицательную окраску тканей рыбы «спящими» микобактериями. Это только одна из возможных причин, требующая проверки.\nИ наоборот, положительная кислотоустойчивая окраска не определяет автоматически род и вид бактерий. Для идентификации может понадобиться дополнительное исследование, например ПЦР или культуральный метод.\nКак правильно сформулировать находку Если использовали фуксин с нагреванием, но не проводили кислотное обесцвечивание, корректно описать и процедуру, и то, что видно:\nИспользована модифицированная окраска фуксином с нагреванием без кислотного обесцвечивания. В ткани обнаружены интенсивно окрашенные палочковидные бактерии. Их кислотоустойчивость не оценивалась.\nВместо этого нельзя заявлять, что выполнена стандартная окраска по Цилю–Нильсену и доказано наличие кислотоустойчивых бактерий.\nГлавное различие: отсутствие отдельного этапа не обнуляет полученные наблюдения, но меняет границы выводов. Метод — не заклинание с неизменными словами, а последовательность действий, каждое из которых должно отвечать на конкретный вопрос.\nЗа историей модификаций, точными режимами исследований и подробной библиографией можно обратиться к полной версии F.O.S.. А версия F. рассказывает ту же историю совсем без лабораторных подробностей.\n","permalink":"https://fossamethod.ru/ru/fo/index_metod/","summary":"Разбираем роль фенола, нагревания и кислоты на примере трёх вариантов окраски материала селезёнки скалярии.","title":"Окраска без фенола: что меняется в методе и выводах"},{"content":"\nГлубина разбора F. F.O. F.O.S. «Гранулёмы — значит тубик» Если при исследовании рыбы в паренхиматозных органах обнаруживаются гранулёмы, следующая мысль часто возникает почти автоматически:\nМикобактериоз.\nИли ещё проще:\nРыбий туберкулёз.\nАссоциация понятна. При микобактериозах рыб гранулёмы действительно встречаются очень часто. Проблема начинается в тот момент, когда характерная реакция организма превращается в название возбудителя. Сначала стоит разобраться, что именно мы увидели.\nЧто такое гранулёма? Типичные гранулемы при микобактериозе. Одно из классических определений гранулёмы — компактное организованное скопление зрелых мононуклеарных фагоцитов, прежде всего макрофагов (крупных иммунных клеток, которые пожирают бактерии, вирусы и клеточный мусор).\nПричём некроз (Необратимая гибель клеток), гигантские клетки (Очень крупные, обычно многоядерные клетки), лимфоциты (Разновидность иммунных клеток) и другие хорошо знакомые элементы гранулёмы могут присутствовать, но не являются обязательными. Важен сам факт организованного скопления зрелых макрофагов (Pagán \u0026amp; Ramakrishnan, 2018). Современное определение можно упростить:\nГранулёма — это организованная попытка макрофагов справиться с тем, с чем один макрофаг справиться не смог.\nPagán и Ramakrishnan предлагают очень наглядную модель:\nЕсли первичный фагоцит захватил объект и смог его уничтожить — соответственно гранулёма не нужна.\nЕсли объект сохраняется, плохо разрушается или слишком велик, начинают привлекаться другие клетки и формируется уже организованная структура (Pagán \u0026amp; Ramakrishnan, 2018).\nТо есть само появление гранулёмы прежде всего говорит:\nчто-то здесь оказалось достаточно стойким, чтобы обычной фагоцитарной реакции (Защитный ответ иммунной системы, при котором клетки (фагоциты, например, макрофаги) распознают, поглощают и переваривают чужеродные частицы, бактерии и отмершие клетки) оказалось недостаточно.\nНе обязательно даже «чужое» Ещё в 1925 году Margaret Reed Lewis наблюдала за поведением моноцитов в культуре. Эти клетки реагировали не только на туберкулёзные бактерии или искусственно добавленные частицы угля.\nОни также захватывали:\nсобственные гранулы меланина (Гранулы меланина представляют собой крошечные внутриклеточные капсулы-контейнеры (органеллы), которые хранят и транспортируют меланин — природный темный пигмент); погибшие гранулоциты (Разновидность лейкоцитов (белых клеток крови), внутри которых содержатся крупные гранулы (капсулы) с активными веществами для борьбы с микробами и воспалением.); эритроциты (Красные кровяные тельца, которые переносят кислород от лёгких ко всем органам и тканям, а обратно забирают углекислый газ.). В процессе культивирования моноциты превращались в макрофаги (Крупные иммунные клетоки, которые пожирают бактерии, вирусы и клеточный мусор). Через несколько суток клетки, захватившие трудноудаляемый материал, приобретали эпителиоидную форму, а некоторые объединялись, образуя многоядерные гигантские клетки (Pagán \u0026amp; Ramakrishnan, 2018).\nПолучается, что для развития гранулематозной реакции принципиально не только деление на «своё» и «чужое».\nВажен другой вопрос:\nможно это быстро удалить или нельзя?\nПогибшая клетка не становится «инородным телом» в буквальном смысле. Она остаётся собственным материалом организма. Но после разрушения клетки остаются мембраны (Тончайшие гибкие оболочки из жиров и белков, которые окружали клетку и её внутренние органеллы, отделяя их от внешней среды.), липиды (Обширная группа природных жиров и жироподобных веществ, которые не растворяются в воде, но хорошо растворяются в органических растворителях), белки (сложные природные органические соединения, состоящие из цепочек аминокислот, которые служат главным строительным материалом и инструментами для всех процессов в организме.) и другой клеточный детрит («мусор» из остатков разрушенных клеток и тканей, который образуется в организме после их гибели, воспаления или травмы.), который необходимо убрать. Если этот материал долго сохраняется в тканях, фагоциты ( К фагоцитам относятся уже знакомые вам макрофаги, моноциты, а также нейтрофилы) продолжают реагировать на его присутствие, пытаясь захватить и удалить остатки разрушенных клеток. Такая реакция может затягиваться и становиться частью хронического гранулематозного воспаления.\nПоэтому формула:\n«гранулёма = инфекционный агент»\nизначально слишком проста.\nМеханизм древнее рыб Гранулематозная реакция вообще оказалась значительно древнее, чем можно было бы ожидать от сложной системы клеточного иммунитета позвоночных. Гранулёмы формируют не только млекопитающие, птицы или рыбы. Они описаны у моллюсков, червей и насекомых (Pagán \u0026amp; Ramakrishnan, 2018). Есть особенно красивый пример. Паразитоидная оса откладывает яйцо в личинку дрозофилы. Яйцо слишком велико, чтобы отдельный фагоцит мог его поглотить. Тогда клетки окружают его и формируют организованную гранулематозную структуру. То есть задача остаётся той же:\nне можешь уничтожить — изолируй.\nУ пресноводного моллюска Corbicula fluminea гранулёматозная реакция может возникать даже вокруг собственных личинок, которые по какой-либо причине не были нормально выведены из организма. Впоследствии их остатки постепенно резорбируются (Pagán \u0026amp; Ramakrishnan, 2018).Трудно придумать более наглядный пример того, почему гранулёма сама по себе ничего не говорит о микобактериях.\nПричин может быть много Гранулематозную реакцию могут вызывать совершенно разные агенты. В обзоре Pagán и Ramakrishnan среди инфекционных причин перечисляются бактерии, грибы, простейшие, гельминты и вирусы. Кроме того, гранулёмы возникают вокруг инородного материала и при целом ряде неинфекционных воспалительных процессов (Pagán \u0026amp; Ramakrishnan, 2018).\nПоэтому логическая цепочка:\nгранулёма → микобактерия\nне работает.\nПравильнее:\nгранулёма → длительно сохраняющийся фактор → выясняем, какой именно.\nДля аквариумной практики микобактериоз при множественных гранулёмах действительно будет одним из первых вариантов, который следует проверить. Но первый дифференциальный диагноз — ещё не установленный диагноз.\nМикобактерии С микобактериями всё становится ещё интереснее. Очень долго гранулёму представляли почти как крепость, которую организм строит вокруг бактерии:\nвот бактерии, вот вокруг них стенка из иммунных клеток — инфекция локализована.\nТакой механизм действительно существует. Но оказалось, что это только половина картины. Исследования Mycobacterium marinum на данио показали, что патогенные микобактерии способны использовать сам процесс образования гранулёмы :\nИнфицированный макрофаг привлекает новые макрофаги. Он погибает. Другой макрофаг поглощает его остатки — вместе с находящимися внутри бактериями. Теперь заражён уже следующий макрофаг. Он тоже становится частью гранулёмы. В экспериментах количество инфицированных макрофагов начинало резко возрастать именно после формирования клеточных агрегатов. Одновременно увеличивалось и количество жизнеспособных микобактерий (Pagán \u0026amp; Ramakrishnan, 2015).\nПолучается почти парадокс:\nорганизм собирает клетки, чтобы локализовать инфекцию, а бактерия использует приходящие клетки как новые места для размножения.\nПричём зрелая гранулёма оказывается не обязательно герметичной капсулой. Клетки продолжают входить в неё и выходить из неё, а инфицированные макрофаги способны покидать первичный очаг и участвовать в формировании новых. (Pagán \u0026amp; Ramakrishnan, 2015)\nПоэтому современное представление о гранулёме намного интереснее старого:\nгранулёма одновременно может ограничивать инфекцию и помогать возбудителю распространяться.\nЧто именно происходит, зависит от стадии процесса, состояния иммунного ответа и свойств самого возбудителя.\nМного гранулём — много бактерий? Не обязательно.\nГранулёма отражает не просто количество возбудителя. Она отражает характер взаимодействия организма с ним. При эффективной организации клеточной реакции могут сформироваться хорошо выраженные гранулёмы. При нарушении работы макрофагов очаги могут становиться дезорганизованными и некротическими, при этом бактериальная нагрузка способна быть очень высокой. В экспериментальных моделях при нарушении действия фактора некроза опухоли (TNF) — сигнального белка, с помощью которого иммунные клетки регулируют воспаление и защиту от инфекции, — микобактерии начинали активно размножаться, а гранулёмы теряли свою организованную структуру (Pagán \u0026amp; Ramakrishnan, 2015).\nПоэтому ситуация: \u0026ldquo;генерализованный микобактериоз, но красивых многочисленных гранулём почти нет\u0026rdquo; - вовсе не противоречива. Иногда это может означать как раз обратное: иммунитет, как система локализации инфекции, работает плохо.\nА если покрасить по Цилю–Нильсену? Вот здесь мы переходим от предположения к следующему уровню доказательности.\nЕсли в гранулёмах обнаруживаются многочисленные палочковидные бактерии, сохраняющие карболовый фуксин после кислотного обесцвечивания, гипотеза микобактериоза становится значительно сильнее. Но и здесь важно не перепрыгнуть ещё через одну ступень. Окраска по Цилю–Нильсену выявляет кислотоустойчивость. Она не определяет автоматически вид бактерии.\nПодробнее здесь: Традиции вместо науки I. Метод: окраска и границы её интерпретации\nДля видовой идентификации уже потребуются другие методы — культуральное исследование, ПЦР, секвенирование или их сочетание.\nГранулёма говорит:\nидёт организованная хроническая тканевая реакция.\nОкраска говорит:\nздесь присутствуют структуры с определёнными тинкториальными свойствами.\nМолекулярный или культуральный метод уже позволяет приблизиться к вопросу:\nкто именно здесь находится?\nОдно не заменяет другое.\nИногда гранулёма оказывается вообще не про бактерии Перед нами две селезёнки рыб с многочисленными беловатыми очагами. В первом случае при микроскопии обнаружены микобактерии. Во втором — внутриклеточные микроорганизмы, морфологически напоминающие Histoplasma.\nПервый снимок приведён специально для сравнения. Внешне оба органа имеют сходные изменения, но микроскопия показывает совершенно разные находки. Именно поэтому наличие множества беловатых узелков ещё не позволяет определить их причину.\nСелезёнка рыбы. Множественные мелкие беловатые гранулематозные очаги. При микроскопии выявлены микобактерии. Селезёнка рыбы. Множественные беловатые узловые образования различного размера. При микроскопии обнаружены внутриклеточные микроорганизмы, морфологически напоминающие Histoplasma.\nМожно встретить множество гранулематозных очагов и не обнаружить в них кислотоустойчивых бактерий. Причиной могут оказаться совершенно другие процессы — например, паразитарные поражения. Именно поэтому сначала лучше описать то, что действительно видно:\n«множественные гранулёмы»\nа уже потом выяснять их этиологию.\nПотому что запись:\n«множественные гранулёмы — микобактериоз»\nнезаметно превращает наблюдение в диагноз.\nФорма гранулёмы тоже имеет значение Печень Apteronotus albifrons с гранулематозными очагами (кислотоустойчивые бактерии выявлены):\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Конкременты в почке неона. Микроскопический препарат почки неона. Округлые и овальные образования различного размера с чёткими контурами и неоднородным содержимым, предположительно минеральные конкременты. Некоторые окружены клеточными структурами, напоминающими гранулематозную реакцию. Микобактерии не выявлены, аналогичные образования в других органах не обнаружены.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Гранулёма — это не просто “узелок” в ткани. Важно и то, как она организована. Морфология очага нередко зависит от того, что находится в его центре и сколько таких центров вообще имеется. Условно можно выделить несколько вариантов.\nЧто влияет на формы гранулем Один компактный центр Если инициирующий фактор невелик, реакция может организоваться вокруг одного центра и давать сравнительно округлую, компактную гранулёму. Большой или неправильный по форме центр Если в основе лежит крупный, неровный или плохо удаляемый объект — например, паразитарная структура, конкремент или массивный участок тканевого распада — гранулёма часто повторяет его контуры и становится менее правильной по форме. Два соседних центра Иногда в ткани расположены два близких очага. Их наружные зоны реакции могут сливаться, создавая впечатление одной сложной гранулёмы. Но наличие двух отдельных центров говорит о том, что это две сближенные гранулёмы, а не одна неправильная. Некротическая и ненекротическая гранулёма Фиброзные узловые образования в почках пескаря (Gobio gobio). Размер обнаруженных образований — от 0,5 до 8 мм. Центральная часть представленных образований имеет однородную структуру. Кислотоустойчивые бактерии не выявлены.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Ещё один важный признак — есть ли в центре некроз.\nЕсли клетки в центре гранулёмы разрушаются и образуют бесструктурную массу, такую гранулёму называют некротической.\nЦентральный некроз характерен для многих микобактериальных гранулём, но встречается и при других заболеваниях. При этом микобактериоз может протекать и без некроза.\nПри некоторых грибковых и паразитарных поражениях можно видеть многочисленные хорошо организованные гранулёмы без центрального некроза — даже при тяжёлом генерализованном процессе.\nВ пределах одного эпизоотического процесса гранулёмы часто имеют сходное строение. Если один и тот же агент поражает однородную группу рыб, тип гранулёматозной реакции — форма, выраженность капсулы, наличие или отсутствие некроза — может повторяться достаточно закономерно. Однако этот морфотип (Совокупность внешних признаков, особенностей строения и формы организма (или клетки), характерных для определенной группы.) характеризует взаимодействие конкретного возбудителя с конкретным хозяином, а не является универсальным свойством возбудителя.\nЧто окружает гранулёму? Важно смотреть не только на центр гранулёмы, но и на её периферию. В одних случаях граница с окружающей тканью выражена слабо. В других очаг окружён несколькими слоями макрофагов, других воспалительных клеток и соединительнотканных элементов.\nСо временем вокруг гранулёмы может формироваться плотная соединительнотканная капсула. Её толщина и выраженность зависят от длительности процесса, природы раздражителя и реакции тканей организма.\nГде здесь «традиции вместо науки»? Не в самой связи гранулём с микобактериозом. Эта связь существует и практически очень полезна. Проблема появляется, когда вероятная причина становится единственно возможной просто потому, что мы привыкли видеть их рядом.\nСхема: «увидел гранулёму → написал \u0026ldquo;туберкулёз\u0026rdquo;» - экономит время.\nНо она выбрасывает всю самую интересную часть диагностики. Что сформировало гранулёму? Есть ли внутри неё бактерии? Кислотоустойчивы ли они? Есть ли вообще инфекционный агент? Что происходит с окружающей тканью? Это локализованный процесс или генерализованный? И только после этого появляется право двигаться от морфологического признака к диагнозу.\nГранулёма — не диагноз.\nЭто след работы организма.\nА задача диагностики — выяснить, из-за чего эта работа понадобилась.\nЛитература Pagán, A.J., Ramakrishnan, L., 2018. The Formation and Function of Granulomas. Annual Review of Immunology 36, 639–665.\nhttps://doi.org/10.1146/annurev-immunol-032712-100022\nОбзор формирования и функций гранулём. Рассматриваются определение гранулёмы, её эволюционное происхождение, инфекционные и неинфекционные причины, реакции на инородные и собственные плохо удаляемые структуры, а также защитная и патологическая роль гранулематозного ответа.\nPagán, A.J., Ramakrishnan, L., 2015. Immunity and Immunopathology in the Tuberculous Granuloma. Cold Spring Harbor Perspectives in Medicine 5, a018499.\nhttps://doi.org/10.1101/cshperspect.a018499\nОбзор взаимодействия микобактерий с гранулёмой. На моделях, включая Mycobacterium marinum у данио, показано, что гранулёма не только ограничивает инфекцию: микобактерии могут использовать привлечение и гибель макрофагов для размножения и распространения.\n","permalink":"https://fossamethod.ru/ru/posts/index_granulomas/","summary":"Гранулёмы — не обязательно микобактериоз. Форма, размер, некроз и выраженность капсулы характеризуют патологический процесс, но не определяют его причину. На примерах различных поражений рыб рассматриваем ограничения морфологической диагностики и опасность подмены наблюдений готовым диагнозом.","title":"Традиции вместо науки IV. Диагноз."},{"content":"\nГлубина разбора F. F.O. F.O.S. FMC В практике лечения аквариумных рыб FMC иногда становится ответом ещё до того, как сформулирован вопрос. Рыба трётся о декорации, усиливается слизистое отделяемое, возникает подозрение на паразитарную инфекцию — назначают ванну.\nСамо по себе это не означает, что решение неверное. FMC действительно содержит биологически активные вещества. Проблема возникает, когда название смеси подменяет обоснование её применения, а факт проведения ванны принимается за доказательство лечения.\nЧтобы различить эти ситуации, нужно понять, что входит в FMC, как возникли схемы его применения и какие параметры определяют результат.\nЧто представляет собой FMC Под FMC в рассматриваемой рецептуре понимается сочетание трёх компонентов:\nФормалина — водного раствора формальдегида, применявшегося против ряда наружных возбудителей заболеваний рыб. Малахитового зелёного — красителя с противопаразитарной активностью. Метиленового синего — красителя с собственной биологической активностью. Смесь потенциально действует на несколько биологических мишеней. Однако её компоненты обладают не только активностью, но и токсичностью. Поэтому фраза «в составе три вещества — значит, точно подействует» не выдерживает проверки.\nДаже если состав известен, по одному названию FMC нельзя определить безопасную и эффективную схему. Для этого нужно знать концентрацию, продолжительность воздействия, состояние рыбы, особенности предполагаемого возбудителя и условия воды.\nОткуда взялся режим применения В полной статье F.O.S. разобрана история смеси по источникам. Её ранним предшественником была комбинация малахитового зелёного с формалином, описанная Leteux и Meyer в 1972 году для контроля Ichthyophthirius и других простейших паразитов рыб (\rпубликация).\nПо изложению в справочнике Gerald Bassleer (2010), трёхкомпонентная рецептура FMC была предложена им в 1979 году. В описанном маточном растворе на один литр формалина приходилось по 3,5 г малахитового зелёного и метиленового синего. Приведённый там режим — 1 мл маточного раствора на 100 л воды с воздействием около двух суток; для лечения ихтиофтириоза предполагалась повторная обработка после замены воды.\nЭто историческое описание конкретной рецептуры и режима, не универсальная инструкция для применения к любой рыбе. Его значение здесь в другом: речь шла о продолжительном контакте с относительно разбавленной смесью, а не о произвольной десятиминутной ванне.\nДля сравнения, в том же справочнике отдельно приводились два режима одного формалина: 1–2 мл на 100 л на 12–48 часов и 0,125–0,25 мл на литр на 30–60 минут.\nПри сравнении важно не смешивать рецептуры: схемы для формалина нельзя автоматически считать схемами для FMC. Даже для одного действующего вещества изменение концентрации одновременно с изменением времени создаёт иной режим воздействия.\nПочему экспозиция неотделима от концентрации Экспозиция — это продолжительность контакта с препаратом. Концентрация определяет, сколько активного вещества присутствует в воде. Вместе они задают условия воздействия, но сами по себе ещё не гарантируют эффективность.\nУсловные «десять минут в FMC» не позволяют оценить результат, пока не известны:\nточная рецептура и фактическая концентрация раствора; длительность контакта и условия воды; какой организм или патологический процесс предполагается устранить; чувствительность этого объекта к выбранному воздействию; переносимость процедуры конкретной рыбой; наблюдения до и после обработки. Важно и то, на какой стадии находится паразит. Если чувствительная стадия недоступна веществу во время краткой ванны, само присутствие активного препарата ещё не означает, что цель достигнута. Расположение паразита на поверхности или в тканях также меняет вероятность контакта с ним.\nПоэтому нельзя рассуждать так: «Формалин действует на эктопаразитов; FMC содержит формалин; значит, десять минут в FMC достаточно». Здесь отсутствует главное звено — данные именно о выбранном режиме против предполагаемого объекта.\nПрепарат характеризуется не только составом, но и условиями его применения. А обоснованность лечения определяется соответствием режима конкретной задаче.\nЧто означает улучшение после ванны Представим рыбу, которая до обработки интенсивно трётся о предметы и выделяет много слизи. На следующий день после ванны раздражение меньше, внешне рыба выглядит лучше.\nЭто наблюдение. Но у него несколько объяснений:\nчасть наружных паразитов могла погибнуть или отделиться; уменьшилось количество слизи на поверхности тела; изменились условия воды при пересадке; сократился контакт с возможным источником заражения; поведение изменилось по причине, не связанной с действием препарата. Без исходной диагностики и повторной проверки нельзя установить, какой из вариантов реализовался. Даже если действительно снизилась паразитарная нагрузка, это не доказывает, что возбудитель уничтожен полностью или что эффект сохранится.\nЗдесь возникает частая логическая ошибка: «после обработки стало лучше» превращается в «благодаря обработке причина болезни устранена». Между этими утверждениями необходимы доказательства.\nЧто проверять до и после Прежде чем оценивать ванну, полезно сформулировать рабочую гипотезу: например, предполагается наружная паразитарная инвазия. Если возможно, выполняют прижизненную микроскопию подходящего материала, фиксируют наличие предполагаемого возбудителя, выраженность изменений и клиническое состояние рыбы.\nЗатем определяют не просто препарат, а цель: уменьшить или устранить конкретную паразитарную нагрузку при допустимом риске для животного. После обработки проверяют, достигнута ли эта цель, а не только улучшился ли внешний вид.\nЕсли исходной проверки не было, вывод об эффективности будет ограничен. Если до и после не оценивали предполагаемого возбудителя, нельзя уверенно утверждать, что он исчез.\nЭто относится и к ситуации, когда рыба чешется. Само трение о предметы не является специфическим признаком паразитарного заболевания и не задаёт автоматически ни диагноз, ни режим терапии.\nПочему многокомпонентная смесь требует большего внимания Наличие нескольких активных веществ создаёт соблазн рассуждать по принципу: «Если не подействует одно, поможет другое».\nНо обратная сторона той же логики — дополнительные ограничения и потенциальная токсическая нагрузка. Если выбранное время недостаточно для воздействия на паразита, но достаточно для раздражения кожи или жабр, процедура способна ухудшить состояние рыбы, не решив исходную проблему.\nЭто не аргумент против FMC как такового. Смесь может быть оправданна, когда известны задача, подходящая схема и критерии проверки результата. Проблема — в назначении без этих условий.\nГде проходит граница между лечением и ритуалом Для осмысленного лечения нужна последовательность:\nНаблюдение → рабочая гипотеза → биологическая мишень → выбор препарата и режима → проверка результата.\nЕсли начать сразу с четвёртого шага, а затем принять любое улучшение за подтверждение диагноза, получим замкнутый круг. Рыба чесалась — назначили FMC — рыба меньше чешется — значит, «FMC помогает от чесания». Но исходная причина так и осталась неизвестной.\nЛечебная ванна — выполненная процедура. Эффективность лечения — вывод, требующий проверки.\nВозраст препарата здесь ни при чём. Старое средство не становится неправильным из-за возраста, но и многолетняя привычка не доказывает эффективность произвольно выбранного режима.\nЛитература Bassleer, G. (2010). Новый иллюстрованный справочник болезней рыб для декоративных тропических и прудовых рыб. М.: «Аква Лого». 232 с. ISBN 978-5-9902638-1-9. Использован для исторической рецептуры FMC и приведённых схем применения; библиографические сведения и обсуждение — в полной статье. Leteux, F., Meyer, F. P. (1972). Mixtures of malachite green and formalin for controlling Ichthyophthirius and other protozoan parasites of fish. The Progressive Fish-Culturist, 34(1), 21–26. DOI. Другие уровни: F. — история без специальных подробностей · F.O.S. — полный разбор.\n","permalink":"https://fossamethod.ru/ru/fo/index_desease/","summary":"Почему десятиминутную ванну FMC нельзя обосновать одним названием препарата и что нужно проверить до и после обработки.","title":"FMC: почему лечебная ванна ещё не означает лечение"},{"content":"\nГлубина разбора F. F.O. F.O.S. Десять минут — и рыба вылечена? Представьте обычную ситуацию в аквариуме. Рыба трётся о камни, на коже появилась слизь, ведёт себя беспокойно. Что с ней происходит? Возможно, её раздражают паразиты. А возможно, причина совсем другая.\nНо решение уже готово: «Искупаем в FMC».\nРыбу на десять минут помещают в воду с препаратом, затем возвращают обратно. Процедура выполнена. Кажется, что теперь осталось лишь дождаться выздоровления.\nНо что на самом деле произошло за эти десять минут? Успел ли препарат подействовать на паразитов? И вообще — были ли они причиной болезни?\nЧто такое FMC? FMC — название смеси веществ, которую используют при лечении некоторых заболеваний рыб. В рассматриваемом здесь варианте в неё входят:\nФормалин — водный раствор формальдегида, действующий на ряд наружных возбудителей, но способный вредить и самой рыбе. Малахитовый зелёный — химический краситель с противопаразитарным действием. Метиленовый синий — ещё один краситель, обладающий биологической активностью. У каждого компонента свои свойства и ограничения. Вместе они не превращаются в универсальное лекарство от любой болезни.\nИ здесь есть важное различие: «средство действует на некоторых паразитов» и «любая ванна с этим средством помогает» — не одно и то же.\nПочему десять минут — не волшебное число Лечение зависит не только от того, что мы добавили в воду. Не менее важно, сколько препарата попало в воду и как долго рыба с ним контактировала.\nПредставьте два разных способа применения: в одном случае в большой объём воды добавляют немного препарата и оставляют его действовать надолго. В другом используют более концентрированный раствор, но ненадолго. Это разные способы воздействия, даже если на этикетке написано одно и то же название.\nКогда исторически предлагали смесь FMC, речь шла о продолжительном воздействии небольшой концентрации препарата — примерно в течение двух суток. А для одного формалина описывались другие, в том числе кратковременные, схемы. Это не значит, что время обработки формалином можно автоматически перенести на смесь FMC. Подробности и источники приведены в разборе F.O..\nОткуда тогда взялись именно десять минут? Если ответ только «мы всегда так делаем», это привычка, а не объяснение.\nА если после ванны рыбе стало лучше? Допустим, на следующий день рыба почти перестала тереться о камни. На коже меньше слизи. Значит, FMC сработал?\nВозможно. Но не обязательно.\nЧасть паразитов могла погибнуть или отделиться. Могла смыться часть слизи. Рыба могла оказаться в более подходящей воде. Раздражение могло уменьшиться и по другой причине. По одному внешнему улучшению нельзя понять, что именно произошло.\nЕсть и обратная ситуация: рыба выглядит лучше, но возбудитель остаётся. Тогда проблема вернётся, хотя сразу после ванны всё казалось успешным.\nЧтобы отличить эти варианты, нужно хотя бы попытаться выяснить, что было до обработки и что изменилось после неё. Например, посмотреть материал с кожи или жабр под микроскопом, если это возможно и оправданно.\nУлучшение внешнего вида — наблюдение. Уничтожение причины болезни — вывод, для которого нужны дополнительные основания.\nА если рыба вообще чесалась не из-за паразитов? Рыба может тереться о предметы по разным причинам. Само это поведение не сообщает нам ни название болезни, ни подходящее лекарство.\nЕсли мы не установили причину, то после ванны не сможем уверенно сказать, что именно лечили.\nОсобенно неприятен вариант, когда паразит устойчив к выбранному воздействию или надёжно защищён в тканях, а препарат успевает дополнительно раздражить кожу и жабры ослабленной рыбы.\nПолучается, мы старались бороться с болезнью, но добавили животному нагрузку, не решив исходную задачу.\nЧто тогда считать лечением? Лечебная ванна — это действие, а лечение — попытка получить определённый биологический результат.\nСначала нужно разобраться, что именно происходит с рыбой. Затем — решить, на какую причину мы собираемся воздействовать. После этого подобрать подходящий способ и проверить, изменилось ли то, ради чего всё затевалось.\nИногда FMC окажется обоснованным выбором. Иногда понадобится совершенно другое действие. А иногда сначала стоит не добавлять препарат, а разобраться с условиями содержания и провести диагностику.\nРыбу искупали — это факт. Рыбу вылечили — это ещё нужно доказать.\nВот почему опасно превращать лечение в привычный ритуал. Не потому, что FMC «плохой» или «старый». А потому, что ни одно лекарство не способно заменить вопрос: «От чего именно я сейчас лечу рыбу?»\nЕсли хочется разобраться глубже: F.O. — почему концентрация и время важнее привычного названия · F.O.S. — полный разбор FMC с историей и литературой.\n","permalink":"https://fossamethod.ru/ru/f/index_desease/","summary":"Рыба чешется — её купают в FMC. Но что мы на самом деле сделали и как узнать, помогло ли это?","title":"Рыбу искупали. А вылечили?"},{"content":"\nГлубина разбора F. F.O. F.O.S. «Рыбка чешется»: где наблюдение превращается в диагноз Рыба резко касается грунта боковой поверхностью тела, иногда повторяя движение несколько раз. В литературе подобное поведение обозначают терминами flashing или rubbing. Его описывают при некоторых эктопаразитозах, заболеваниях кожи и поражениях жабр.\nСамо движение наблюдаемо. Но привычное объяснение часто возникает раньше проверки:\n«Рыба чешется» → «Она чешет жабры» → «Значит, у неё жаберные паразиты».\nВ этой цепочке первый шаг — бытовое описание поведения. Второй — предположение о локализации раздражения. Третий — предположение о причине. Каждый новый шаг требует данных, которых нет в одном только движении.\nВопрос не в том, может ли flashing сопровождать паразитарную инвазию. Может. Вопрос в другом: насколько это поведение специфично и можно ли по его особенностям различить возможные причины?\nПочему одинаковое поведение не обязательно означает одинаковую причину В исходной статье F.O.S. предложен мысленный эксперимент.\nПредставим две группы рыб:\nу первой выражено раздражение наружных покровов, например при резко неподходящем pH; у второй диагностированы моногенеи на жабрах. Допустим, в обеих группах наблюдается трение о грунт. Наблюдатель видит только записи движений, не знает результатов обследования и должен указать, где какая причина.\nЕсли специалист уверенно различает ситуации, можно задать проверяемый вопрос: какие конкретно признаки движений он использует? Место первого контакта? Положение головы? Угол разворота? Скорость? Частоту повторений? Связь с дыхательными движениями?\nДальше эти признаки следовало бы заранее описать и проверить на независимых видеозаписях, где диагноз установлен другими методами. Желательно, чтобы оценивающий не знал, к какой группе относится рыба. Только после этого можно обсуждать диагностическую точность такого признака, а не личную уверенность наблюдателя.\nВажно: это предложение способа проверки гипотезы, а не опубликованный эксперимент, доказавший одинаковую кинематику при разных состояниях. В приведённых ниже источниках нет подтверждённого теста, который по одному движению надёжно отличал бы поражение жабр от раздражения кожи.\nЧто подтверждено исследованиями Паразиты и flashing Garcia и соавт. (2014) описали при поражении радужной форели гиродактилидами в том числе беспорядочные движения и flashing. Это показывает, что трение может встречаться при паразитарной инвазии. Но наличие признака в группе заражённых рыб не означает, что он встречается только при этой инвазии или позволяет определить место поражения без дополнительного обследования.\nGarcia et al., 2014\nЗаболевание кожи и flashing Maddocks и соавт. (2016) описали сходное движение при puffy skin disease у радужной форели — заболевании с выраженными кожными изменениями. Рыбы опускались к дну, тёрлись боковой поверхностью и быстро выпрямлялись.\nЭто важный контрпример для фразы «так рыба обязательно чешет жабры»: сходное поведение описано и при патологии кожи.\nMaddocks et al., 2016\nМожет ли вода вызывать раздражение без паразитов? Mettam и соавт. (2012) изучали чувствительные нервные окончания в области головы радужной форели. Они регистрировали ответы на ряд химических раздражителей, включая кислые растворы и низкий pH.\nЭто физиологическое основание рассматривать раздражающие факторы среды независимо от паразитарной инвазии. Но исследование измеряло активность рецепторов, а не различия между видами flashing. Нельзя ссылаться на него как на прямое экспериментальное доказательство, что рыбы при низком pH обязательно трутся о грунт определённым способом.\nMettam et al., 2012\nТаким образом, научные работы поддерживают несколько возможных объяснений поведения, но не дают права выбирать единственное без проверки.\nМожно ли «почесать жабры»? Жаберные лепестки расположены в жаберной полости, под жаберной крышкой. При наружном контакте с камнем или грунтом рыба может задеть кожу головы, жаберную крышку или область жаберной щели. Сами жаберные лепестки при этом не обязательно соприкасаются с предметом.\nЗдесь полезно разделить три утверждения:\nНаблюдение: рыба резким движением трётся о грунт. Физиологическая гипотеза: раздражение жабр могло вызвать такую двигательную реакцию. Предположение о цели движения: рыба пытается почесать именно жаберные лепестки. Второе вполне допустимо в качестве рабочей гипотезы. Третье — гораздо более сильное утверждение: оно приписывает движению конкретную направленность, которая не следует из видео сама собой.\nБолее того, при наличии жаберной инвазии flashing может сосуществовать с поражениями других поверхностей. Даже подтверждённые моногенеи на жабрах не доказывают, что каждый боковой контакт с декорацией направлен именно на жабры.\nПоэтому формулировка «раздражение жабр может сопровождаться flashing» точнее, чем безоговорочное «рыба чешет жабры».\nКакие наблюдения полезны, а каких недостаточно В описании поведения можно зафиксировать частоту эпизодов, сторону тела, область контакта, последовательность движений, условия и изменения со временем. Всё это потенциально полезно для последующего анализа.\nНо подробность наблюдения не равна его диагностической специфичности. Даже качественная запись не позволяет сама по себе установить паразитарную этиологию, если соответствие между определённым движением и причиной не проверено.\nВ практической диагностике данные поведения следует сопоставлять с другими признаками и результатами исследований:\nоценкой параметров воды и недавних изменений условий содержания; состоянием кожи, плавников, жаберной области и характером дыхания; распространённостью поведения среди рыб в системе и динамикой симптомов; при обоснованных показаниях — микроскопией соскобов или подходящего материала с жабр с учётом риска процедуры для рыбы. Результаты такого обследования позволяют проверять конкурирующие объяснения. Например, обнаружение моногеней — самостоятельное диагностическое свидетельство; оно не появляется из-за того, что рыба «характерно чесалась». И наоборот, отсутствие видимых паразитов на поверхностном препарате само по себе не исключает поражения жабр или другой причины.\nНаблюдение, интерпретация, диагноз Удобно разделять итог на три уровня:\nУровень Пример формулировки Чего ещё не доказано Наблюдение «Повторяющиеся резкие боковые контакты с грунтом» Почему они возникают Интерпретация «Возможно, поведение связано с раздражением кожи или жабр» Источник раздражения и его локализация Диагностическая гипотеза «Следует исключить эктопаразитарную инвазию» Наличие и идентификация возбудителя Предположение не становится неправильным только потому, что оно пока не доказано. Ошибка возникает, когда его записывают как уже установленный факт.\nМы наблюдаем поведение. Причину этого поведения ещё нужно доказать.\n«По рыбе видно» может быть началом профессиональной догадки. Чтобы она стала диагностическим критерием, нужно суметь объяснить, что именно видно, и показать, насколько надёжно это связано с предполагаемой причиной.\nИсточники и продолжение Garcia R. L., Hansen A. G., Chan M. M., Sanders G. E. (2014). Gyrodactylid Ectoparasites in a Population of Rainbow Trout (Oncorhynchus mykiss). Journal of the American Association for Laboratory Animal Science, 53(1), 92–97. Полный текст. Mettam J. J., McCrohan C. R., Sneddon L. U. (2012). Characterisation of chemosensory trigeminal receptors in the rainbow trout, Oncorhynchus mykiss: responses to chemical irritants and carbon dioxide. Journal of Experimental Biology, 215(4), 685–693. DOI. Maddocks C. E. et al. (2016). Puffy Skin Disease Is an Emerging Transmissible Condition in Rainbow Trout Oncorhynchus mykiss Walbaum. PLOS ONE, 11(7), e0158151. Полный текст. Другие уровни: F. — простая история · F.O.S. — исходный полный разбор.\n","permalink":"https://fossamethod.ru/ru/fo/index_fish_scrab/","summary":"Flashing — наблюдаемое поведение, но не локализация поражения и не диагноз. Разбираем мысленный эксперимент, физиологию раздражения и пределы клинических выводов.","title":"Рыба трётся о предметы: поведение, причина и диагноз"},{"content":"\nГлубина разбора F. F.O. F.O.S. Рыбка чешется Рыба подплывает к камню, резко поворачивается боком и задевает его телом. Через некоторое время повторяет движение.\n«Рыбка чешется», — скажет наблюдатель.\nВозможно, следом прозвучит: «Наверное, у неё что-то с жабрами». А потом: «Скорее всего, паразиты».\nЗнакомая цепочка. Только в ней три разных утверждения — и достоверно мы видели лишь первое движение.\nА что мы на самом деле увидели? Мы увидели, как рыба потёрлась о поверхность. Такое поведение действительно бывает при заболеваниях рыб. В научных работах его обычно называют flashing или rubbing — резкий боковой контакт с предметом или дном.\nНо из самого движения не видно, почему рыба это сделала.\nВозможно, её раздражает кожа. Возможно, проблема связана с жабрами. Возможно, на неё действует что-то в воде. А может быть, причина иная. Одно и то же действие не обязательно имеет одну и ту же причину.\nСлово «чешется» удобно в разговоре. Но оно уже подсказывает объяснение, которого мы пока не проверяли.\nДве рыбы, одно движение Представим проверку. В одном аквариуме у рыбы раздражена кожа из-за неподходящего состава воды, например слишком низкого pH. В другом на жабрах у рыбы находятся паразитические черви — моногенеи.\nИ допустим, что обе рыбы резко трутся о грунт. Нам показывают только видеозаписи, не сообщая, что происходит в каждом аквариуме.\nСможем ли мы понять по движению, где причина в воде, а где — в паразитах?\nМожет быть, у движений действительно есть отличия. Но тогда их нужно назвать: как поворачивается рыба, какой частью тела касается поверхности, как часто повторяет движение. А затем проверить, помогают ли эти признаки правильно различать причины.\nЕсли же объяснение одно — «ну, это сразу видно», — перед нами пока не доказательство, а впечатление.\nЭто мысленный пример, а не описание проведённого опыта. Но он показывает, какого именно доказательства нам не хватает.\nА можно вообще чесать жабры о камень? Вот здесь самое интересное.\nЖабры находятся внутри жаберной полости, за жаберной крышкой. Когда рыба трётся о камень, она касается его наружной частью тела — кожей, головой, жаберной крышкой.\nПри этом раздражение жабр действительно может быть связано с таким поведением. Но это не значит, что рыба физически трёт о камень сами жаберные лепестки.\nПоэтому есть разница между двумя фразами:\n«Раздражение жабр может вызывать такое движение».\nИ:\n«Рыба чешет жабры».\nПервая говорит о возможной причине. Вторая звучит так, будто мы уже знаем, что именно рыба пытается почесать. А этого мы не знаем.\nЧто делать, если рыба начала тереться? Не игнорировать поведение. Но и не назначать диагноз по одному движению.\nСначала стоит посмотреть, что ещё изменилось: как рыба дышит, питается, как выглядят кожа и плавники, есть ли такие же проявления у соседей. Проверить параметры воды. Если есть основания подозревать паразитов — исследовать подходящий материал под микроскопом.\nТрение о предметы — полезный сигнал обратить внимание на рыбу, но не готовый ответ о причине.\nВ исследованиях такое поведение описывали и при паразитарном поражении (\rGarcia и соавт., 2014), и при заболевании с выраженными изменениями кожи (\rMaddocks и соавт., 2016). А чувствительность нервных окончаний рыб к химическим раздражителям, включая низкий pH, изучали отдельно (\rMettam и соавт., 2012). Последняя работа показывает возможность химического раздражения, но не доказывает, что низкий pH обязательно вызывает именно такое трение.\nГде заканчивается наблюдение Можно уверенно сказать: «Рыба резко касается грунта боком».\nМожно предположить: «Возможно, её что-то раздражает».\nНо сказать: «Она чешет жабры из-за моногеней» — значит сделать сразу несколько выводов, которые ещё предстоит проверить.\nМы наблюдаем поведение. Причину этого поведения ещё нужно доказать.\nИменно с этого различия начинается диагностика, а не угадывание.\nЕсли хочется разобраться глубже: F.O. — как проверить интерпретацию поведения · F.O.S. — полный разбор с научными источниками.\n","permalink":"https://fossamethod.ru/ru/f/index_fish_scrab/","summary":"Мы видим, как рыба касается камней. Но видим ли мы причину? История о разнице между наблюдением и догадкой.","title":"Рыбка чешется. Но от чего?"},{"content":"\nГлубина разбора F. F.O. F.O.S. В коллекции моего виртуального микроскопа долго находился препарат с простым названием: «Микобактерии». Красные палочковидные структуры на синем фоне, окраска по Цилю — Нильсену. Всё выглядело знакомо — пока я не посмотрел на эти структуры внимательнее.\nЧасть оказалась не просто удлинёнными палочками. Они ветвились. Возник вопрос: а почему я вообще решил, что это микобактерии?\nКрасные палочки — наблюдение. Микобактерии — уже идентификация. Между ними есть несколько проверок, которые легко пропустить.\nЭта статья не о том, как по одному изображению назвать возбудителя. Она о том, почему привычное слово «тубик» иногда мешает увидеть гораздо более интересную картину.\nАктиномицеты — это бактерии или грибы? Бактерии. Название «актиномицеты» исторически связано с нитевидным, иногда ветвящимся ростом, напоминающим грибной мицелий. Но сходство внешнее: ни Nocardia, ни Mycobacterium не являются грибами.\nОба рода относятся к крупной группе Actinomycetota (актиномицеты) и одному порядку Mycobacteriales, но к разным семействам: Mycobacterium — Mycobacteriaceae, Nocardia — Nocardiaceae (NCBI Taxonomy: Mycobacterium) (NCBI Taxonomy: Nocardia).\nТо есть актиномицеты — не синоним нокардий и не обозначение исключительно нитевидных бактерий. Микобактерии тоже актиномицеты, хотя обычно выглядят как отдельные палочки.\nЧто мы называем «веточками»? Для Nocardia характерен рост в виде тонких, нередко разветвлённых нитей. Нити могут фрагментироваться; в препарате тогда видны отдельные короткие палочки. Более того, у N. seriolae в культуре показана смена морфологии в зависимости от фазы роста: от нитевидных клеток до коротких палочек и кокковидных форм (Growth characteristics, 2010).\nУ микобактерий обычнее палочковидная форма. Однако форма не даёт абсолютной границы: отдельные представители и состояния могут иметь необычную морфологию, а наложение бактерий создаёт ложное впечатление ветвления.\nЧто полезно искать под микроскопом?\nНепрерывное ответвление от одной нити, а не простое пересечение двух палочек. Нитевидные структуры с неодинаковой толщиной и окраской. Фрагментацию нитей на более короткие элементы. Повторяемость сходной морфологии в разных участках препарата. Все эти признаки помогают сформулировать гипотезу, но ни один не определяет род бактерии самостоятельно.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Почему одни бактерии «частично кислотоустойчивые»? Здесь легко ошибиться.\nЧастичная кислотоустойчивость — не значит, что бактерия частично похожа на палочку или обязательно окрашена пятнами. Речь о том, насколько устойчиво клетка удерживает первичный краситель после обесцвечивания.\nУ Mycobacterium и Nocardia клеточная оболочка содержит миколовые кислоты, но её химическое строение и свойства различаются. Поэтому многие нокардии проявляют слабую или вариабельную кислотоустойчивость: при мягкой дифференцировке окраска может сохраняться, а при более жёсткой — частично или полностью исчезать. Для их выявления используют модифицированные методы с более мягким обесцвечиванием (Brown-Elliott et al., 2006).\nНо это не железное правило «стандартный Циль — микобактерии, слабая кислота — нокардии». Нокардии могут оставаться окрашенными и после Циля — Нильсена. И наоборот, результат зависит от вида, состояния бактерий и условий обработки.\nВ публикации о Nocardia seriolae у красного горбыля авторы показали окраску по Граму, Цилю — Нильсену и Фите — Фарако. Они описали светлые участки нитевидных структур как проявление частичной кислотоустойчивости (del Rio-Rodriguez et al., 2021). Это авторская интерпретация изображений; по одним только светлым промежуткам в чужом мазке надёжно различить роды нельзя.\nЕсли кислотного обесцвечивания вообще не было, нельзя даже сказать «частично кислотоустойчивые». Мы видим фуксин-положительные структуры, но это свойство пока не проверяли.\nПодробнее о том, что доказывают отдельные этапы окрашивания, — в статье «Традиции вместо науки I. Метод».\nСлучай, в котором «микобактерии» оказались нокардиями В исследовании del Rio-Rodriguez и соавторов (2021) описана вспышка заболевания у выращиваемого в Мексике красного горбыля (Sciaenops ocellatus). У рыб обнаруживали язвенные поражения и множественные светлые узлы во внутренних органах, особенно в почках и селезёнке. В хозяйстве зарегистрировали высокую совокупную смертность — до 70%.\nВ мазках, соскобах и срезах тканей исследователи видели длинные ветвящиеся, местами зернисто окрашенные, грамположительные и кислотоустойчивые бактерии. Такая картина допускала дифференциальный диагноз между нокардиозом и микобактериозом. Но итоговое определение Nocardia seriolae было получено не по рисунку: использовались выделение культуры, родо- и видоспецифическая ПЦР и секвенирование гена gyrB (del Rio-Rodriguez et al., 2021).\nВетвление подсказало, что нужно искать Nocardia. Идентификация потребовала других методов.\nА гранулёмы? Разве это не «тубик»? Нет. Гранулёматозное воспаление — реакция тканей, а не название возбудителя. И микобактерии, и нокардии способны вызывать у рыб тяжёлые гранулематозные поражения. В обзоре Maekawa и соавторов (2018) нокардиоз описан как заболевание, затрагивающее кожу, мышцы и внутренние органы костистых рыб (Maekawa et al., 2018).\nПоэтому сочетание «светлые узлы в почках + красные палочки в мазке» ещё не позволяет автоматически написать «микобактериоз». Это обоснование для дальнейшего исследования, а не готовое видовое определение.\rТрадиции вместо науки IV. Диагноз.\rГранулёмы, некроз и микобактериоз рыб: почему сходные морфологические признаки не означают одинаковую этиологию и не могут служить …\rИ пока у нас нет выборки подтверждённых случаев, нельзя объявить, что у пресноводных рыб крупные палочки чаще оказываются нокардиями или что соотношение нокардий и микобактерий составляет «50 на 50». Наблюдение о разных морфотипах в разных препаратах — хорошее начало для проверки, но не статистика распространённости.\nЧем отличаются заболевания, если смотреть не на форму, а на патогенность? Здесь и возникает практический смысл сравнения. Грамотное морфологическое описание нужно не для того, чтобы красиво подписать фотографию. За внешне похожими гранулёматозными поражениями могут стоять разные возбудители с разной эпидемиологией и разной чувствительностью к препаратам.\nМикобактериоз у рыб чаще описывают как хроническую прогрессирующую инфекцию. Он может сопровождаться истощением, изменениями кожи, поражением почек, селезёнки и других органов, формированием гранулём. Возбудители различаются по видам, скорости роста и биологическим свойствам. Например, Mycobacterium marinum — известный патоген рыб, способный вызывать инфекцию и у человека при попадании в повреждённую кожу (Merck Veterinary Manual).\nНокардиоз тоже бывает хронической системной инфекцией. Нередко обнаруживаются множественные белые узлы в органах, участки некроза, кожные поражения. Нокардии нельзя считать менее патогенными только потому, что они не микобактерии. Например, в работе Zhang и соавторов (2024) исследовали десять изолятов N. seriolae, выделенных от пресноводных рыб — большеротого окуня (Micropterus salmoides) и змееголова (Channa argus). При экспериментальном заражении смертность в отдельных группах достигала 70–100% (Zhang et al., 2024).\nЭто не означает, что всякая Nocardia вызывает такую смертность. Патогенность зависит как минимум от вида и штамма бактерии, вида и состояния рыбы, пути заражения, дозы и условий содержания. Но пример показывает: по тяжести процесса автоматически отделить нокардиоз от микобактериоза нельзя.\nВажно также не путать патогенность с количеством окрашенных палочек. Интенсивная окраска, более длинные нити или крупные гранулёмы не служат прямой мерой вирулентности. И наблюдаемая смертность в хозяйстве сама по себе не идентифицирует возбудителя.\nРезистентность: к кислоте, антибиотикам или условиям среды? Слово «устойчивость» здесь способно запутать сильнее, чем сами микрофотографии.\nКислотоустойчивость — тинкториальный признак. Она характеризует удержание красителя после определённой обработки и зависит, в частности, от особенностей липидсодержащей клеточной оболочки. Антибиотикорезистентность — другое свойство: снижение чувствительности к определённому антимикробному препарату, связанное с конкретными клеточными механизмами. А персистирование инфекции в организме — ещё один вопрос: возбудитель может сохраняться в тканях и гранулёматозных очагах даже тогда, когда лабораторный тест показывает чувствительность к некоторым веществам.\nЕсли бактерия удерживает фуксин после кислоты, мы ничего не узнали о том, будет ли действовать доксициклин, флорфеникол или другое средство.\nУ обоих родов клеточная оболочка содержит миколовые кислоты, но это не делает их профили лекарственной чувствительности одинаковыми. Различия определяются на уровне конкретного вида и изолята. И одно лишь обнаружение генов предполагаемой резистентности тоже не заменяет проверку фенотипической чувствительности.\nНаглядный пример даёт N. seriolae. В исследовании Zhang и соавторов (2024) один из наиболее патогенных изолятов проявлял устойчивость к исследованным β-лактамным препаратам, но чувствительность к ряду антибиотиков других классов (Zhang et al., 2024). В работе Nguyen и соавторов (2026) у 13 изолятов из заболевших рыб выявили сниженную чувствительность к триметоприму-сульфаметоксазолу относительно использованных пороговых значений, тогда как по флорфениколу и окситетрациклину изоляты относились к популяции дикого типа (Nguyen et al., 2026). Это не готовая таблица лечения: исследования проводились на разных выборках, с разными методами и критериями, а для многих возбудителей рыб клинические пороговые значения ограничены.\nДля микобактериоза рыб ситуация также непроста. Помимо биологических особенностей возбудителя, препятствием становятся хроническое течение и труднодоступные очаги инфекции. Согласно ветеринарному руководству Merck, эффективных способов устранения микобактериальной инфекции у рыб в обычной практике нет (Merck Veterinary Manual).\nА устойчивость к дезинфицирующим средствам — третья самостоятельная задача. Из результата Циля — Нильсена нельзя вывести, какой режим обработки системы, оборудования или поверхностей будет эффективен: его подбирают по соответствующим данным о действующем веществе, концентрации, экспозиции и органической нагрузке.\nЧто это меняет в аквариумной практике? Диагностический поиск. Ветвящиеся грамположительные структуры с вариабельной кислотоустойчивостью дают повод включить Nocardia в дифференциальный ряд, а не считать все гранулёмы микобактериозом. Оценка риска. Подтверждённый возбудитель, распространённость поражений и состояние других рыб важнее, чем наличие одной эффектной «веточки» в мазке. Тактика работы с материалом. При серьёзном подозрении на системную бактериальную инфекцию желательно сохранить подходящие образцы для культурального и молекулярного исследования, а не ограничиваться красной окраской на стекле. Лечение. Даже подтверждённый род бактерии не заменяет определения чувствительности к препаратам и оценки того, возможно ли добиться терапевтической концентрации в поражённых тканях без неоправданного воздействия на рыб и систему жизнеобеспечения. Безопасность персонала. При работе с материалом от рыб с подозрением на микобактериоз следует учитывать известный зоонозный риск некоторых видов, прежде всего M. marinum (Merck Veterinary Manual). Этот риск нельзя автоматически переносить в том же объёме на все Nocardia. Теперь становится ясно, зачем нам отличать «веточки» от «палочек». Не чтобы поставить диагноз по форме, а чтобы выбрать правильные проверки и избежать ошибочного решения о лечении.\nЧто делать с необычным препаратом? Начинать стоит с точного описания того, что видно, не подменяя его названием бактерии.\nУровень наблюдения: фуксин-положительные палочковидные или нитевидные структуры; есть ли предполагаемое ветвление, зернистость, отдельные фрагменты.\nУровень метода: было ли кислотное обесцвечивание, каким способом оно проводилось, с какими контролями. Положительная окраска по Цилю — Нильсену устанавливает проявление кислотоустойчивости в использованных условиях, а не род бактерии.\nУровень идентификации: если определение возбудителя принципиально для диагноза, нужны дополнительные данные — например, исследование по Граму, бактериологическое выделение и молекулярная идентификация. Даже микроскопически убедительное ветвление не заменяет подтверждения.\nДля описания непроверенной находки подойдёт, например:\n«В мазке-отпечатке селезёнки обнаружены фуксин-положительные палочковидные и нитевидные структуры с предполагаемым ветвлением. Морфология допускает присутствие ветвящихся актиномицетов, в том числе представителей рода Nocardia. Родовая принадлежность не установлена».\nА если кислотное обесцвечивание не проводилось, это следует указать отдельно и не называть структуры кислотоустойчивыми.\nВместо вывода Мы привыкли смотреть на красные палочки и мысленно дописывать «микобактерии».\nФорма подсказывает, что проверить. Окраска показывает свойство в конкретных условиях. Название возбудителя требует доказательств.\nИ именно поэтому необходимо показывать и запечатлевать то, что наблюдается, даже когда окончательное определение пока неизвестно.\nЛитература del Rio-Rodriguez, R.E., et al., 2021. First evidence of fish nocardiosis in Mexico caused by Nocardia seriolae in farmed red drum (Sciaenops ocellatus, Linnaeus). Journal of Fish Diseases, 44, 1117–1130. https://doi.org/10.1111/jfd.13373 Maekawa, S., Yoshida, T., Wang, P.-C., Chen, S.-C., 2018. Current knowledge of nocardiosis in teleost fish. Journal of Fish Diseases, 41, 413–419. https://doi.org/10.1111/jfd.12782 Growth Characteristics and Morphological Changes of Fish Pathogen Nocardia seriolae in Submerged Culture, 2010. Aquaculture Science, 58, 429–431. https://doi.org/10.11233/aquaculturesci.58.429 Brown-Elliott, B.A., Brown, J.M., Conville, P.S., Wallace, R.J. Jr., 2006. Clinical and Laboratory Features of the Nocardia spp. Based on Current Molecular Taxonomy. Clinical Microbiology Reviews, 19(2), 259–282. https://pmc.ncbi.nlm.nih.gov/articles/PMC1471991/ Zhang, W., et al., 2024. Biological characteristics and pathogenicity comparison of Nocardia seriolae isolated from Micropterus salmoides and Channa argus. Frontiers in Veterinary Science, 11, 1367066. Экспериментальная патогенность изолятов пресноводных рыб и исследование чувствительности к антибиотикам. https://doi.org/10.3389/fvets.2024.1367066 Nguyen, A.T., et al., 2026. First Report of Nocardiosis Caused by Nocardia seriolae in Farmed Spotted Scat (Scatophagus argus). Journal of Fish Diseases, 49(9), e70171. Исследование 13 изолятов, различия минимальных подавляющих концентраций и ограниченность переноса пороговых значений. https://doi.org/10.1111/jfd.70171 Petty, B.D., Francis-Floyd, R., Yanong, R.P.E., 2024. Bacterial Diseases of Fish. Merck Veterinary Manual. Микобактериоз рыб: течение, ограничения лечения и зоонозный риск отдельных видов. https://www.merckvetmanual.com/exotic-and-laboratory-animals/aquarium-fish/bacterial-diseases-of-fish NCBI Taxonomy. Mycobacterium (Taxonomy ID 1763). https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=1763 NCBI Taxonomy. Nocardia (Taxonomy ID 1817). https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=1817 ","permalink":"https://fossamethod.ru/ru/posts/twigs_and_sticks/","summary":"Что говорят ветвление и кислотоустойчивость о бактериях рыб, почему нокардиоз не обязательно легче микобактериоза и как оценивать лекарственную чувствительность.","title":"Веточки и палочки. Кого мы видим в препарате?"},{"content":"\nГлубина разбора F. F.O. F.O.S. Когда знакомые палочки оказались незнакомыми В коллекции моего виртуального микроскопа был препарат с названием «Микобактерии». На синем фоне хорошо различались красные палочки. Всё выглядело привычно — пока я не заметил, что некоторые из них ветвятся.\nИ возник вопрос: откуда я знаю, что это именно микобактерии?\nВедь красный цвет и палочковидная форма — это то, что можно увидеть. А название бактерии — уже вывод, который нужно проверить.\nУвидеть бактерию — не то же самое, что узнать, какая это бактерия.\nПочему «веточки» важны? Среди бактерий, способных поражать рыб, есть Mycobacterium и Nocardia. Микобактерии чаще выглядят как отдельные палочки. Нокардии могут образовывать длинные разветвлённые нити, которые затем распадаются на короткие части.\nНо эти различия не работают как готовый определитель. Палочки могут пересекаться, создавая ложное впечатление ветвления. А нокардии не обязаны всегда выглядеть как веточки.\nПосмотри на два препарата. Их можно перемещать и увеличивать независимо.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл В одном препарате заметны более длинные, местами ветвящиеся структуры; в другом — небольшие палочковидные. Разница видна, но название бактерии по этим изображениям ещё не доказано.\nА специальная окраска разве не даёт ответа? Окраска по Цилю — Нильсену помогает обнаруживать бактерии, которые сохраняют краситель после обработки кислотой. Такое свойство называют кислотоустойчивостью.\nНо сохранять окраску могут не только микобактерии. Некоторые нокардии тоже обладают этим свойством, хотя оно нередко выражено слабее.\nЕсли же кислотой препарат вообще не обрабатывали, о кислотоустойчивости судить нельзя — даже когда бактерии ярко-красные.\nА зачем вообще выяснять, кто перед нами? Потому что дело не только в правильной подписи к фотографии. И нокардии, и микобактерии могут вызывать у рыб тяжёлые заболевания, поражать внутренние органы и сопровождаться появлением гранулём. Нокардиоз бывает причиной серьёзных потерь даже в пресноводных хозяйствах — считать его безобидной версией микобактериоза нельзя (Zhang et al., 2024).\nА ещё от точного определения возбудителя зависит оценка возможного лечения. У разных бактерий и даже у разных штаммов одного вида различается чувствительность к антибиотикам. Кислотоустойчивость при окрашивании не говорит, какой препарат подействует. И сам по себе положительный лабораторный тест не обещает выздоровления рыбы с поражёнными органами.\nОпределить бактерию важно не ради названия. Это нужно, чтобы оценить заболевание и не выбирать лечение по виду красных палочек.\nЗначит, как поступить? Сначала записать то, что действительно видно: палочковидные или нитевидные структуры, их количество, расположение, окраску, возможное ветвление.\nПотом указать, какую именно обработку прошёл препарат. И только после этого решать, какие бактерии следует искать и какими дополнительными методами подтверждать предположение.\nВеточки и палочки — это наблюдение. Нокардии и микобактерии — гипотезы, которые требуют проверки.\nДля более подробного объяснения: F.O. — как различать форму и кислотоустойчивость · F.O.S. — исследование, микрофотографии и научные источники.\n","permalink":"https://fossamethod.ru/ru/f/twigs_and_sticks/","summary":"Веточки и палочки: как отличать наблюдение от диагноза и почему это важно для оценки болезни и лечения рыб.","title":"Веточки и палочки. Можно ли узнать бактерию по форме?"},{"content":"\nГлубина разбора F. F.O. F.O.S. Почему красные палочки перестали быть «микобактериями» В моём виртуальном микроскопе препарат долго назывался просто: «Микобактерии». Но повторное рассмотрение показало, что часть красных структур не только удлинена — у некоторых заметны предполагаемые ответвления.\nЭто хороший повод усомниться в привычной подписи. Окраска и форма позволяют описать морфологию и тинкториальные свойства. Род бактерии они сами по себе не устанавливают.\nКрасная палочка — наблюдение. «Это Mycobacterium» — уже проверяемая гипотеза.\nНокардии, микобактерии и актиномицеты И Nocardia, и Mycobacterium — бактерии. Оба рода относятся к актиномицетам (Actinomycetota) и порядку Mycobacteriales, хотя принадлежат к разным семействам.\nСлово «актиномицеты» иногда вводит в заблуждение: у части представителей встречается нитевидный, похожий на грибной мицелий рост. Но это не грибы и не группа, состоящая исключительно из ветвящихся бактерий.\nДля нокардий характерны разветвлённые нити, которые могут фрагментироваться и выглядеть как короткие палочки. Для микобактерий обычнее палочковидная форма. Однако абсолютной морфологической границы здесь нет: внешний вид зависит и от вида, и от состояния клеток, и от приготовления препарата.\nКак убедиться, что ветвление настоящее? Под микроскопом важно отличать непрерывное ответвление одной нити от простого пересечения двух бактерий. Полезно оценить, повторяется ли сходная картина в разных участках препарата, есть ли отдельные фрагменты нитей, насколько однородны их форма и окраска.\nНо и хорошо различимое ветвление не означает автоматически Nocardia: встречаются другие ветвящиеся актиномицеты. Кроме того, N. seriolae при культивировании может переходить от нитевидных форм к коротким палочкам и кокковидным клеткам (Growth characteristics, 2010).\nДля самостоятельного сравнения можно исследовать два препарата. Это два морфотипа, а не два подтверждённых рода бактерий.\nЯркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл Что означает «частично кислотоустойчивые»? Это не определение формы и не просто наличие светлых промежутков в красной нити. Речь о способности клеток сохранять первоначальную окраску после обработки определённым обесцвечивающим раствором.\nКлеточные оболочки Mycobacterium и Nocardia содержат миколовые кислоты, но их состав и строение различаются. Многие нокардии демонстрируют слабую или вариабельную кислотоустойчивость: после более мягкого обесцвечивания краситель может сохраняться, после более жёсткого — утрачиваться. Поэтому для поиска нокардий часто используют модифицированные варианты окраски с более мягкой дифференцировкой, например 1%-й серной кислотой (Brown-Elliott et al., 2006).\nЭто не значит, что стандартная окраска по Цилю — Нильсену обязательно обесцветит все нокардии, а все микобактерии обязательно сохранят цвет. На результат влияют вид бактерии, состояние клеток и условия процедуры.\nИ ключевое ограничение: если этап кислотного обесцвечивания отсутствовал, кислотоустойчивость вообще не проверяли. Тогда корректно описывать фуксин-положительные структуры, не называя их кислотоустойчивыми.\nПодробно различие между наблюдением и результатом методики разобрано в статье «Традиции вместо науки I. Метод».\nПочему гранулёмы не помогают выбрать род? Оба рода способны вызывать у рыб хроническое воспаление и гранулематозные поражения. Белые узелки в селезёнке или почках, даже в сочетании с красными палочками, не равны диагнозу «микобактериоз». Это основание продолжить исследование.\nВ работе del Rio-Rodriguez и соавторов (2021) у красного горбыля обнаружили длинные ветвящиеся бактерии и гранулематозные поражения. Возбудитель оказался Nocardia seriolae. Но название было подтверждено не по форме на изображении: применялись бактериологические и молекулярные методы, включая секвенирование (del Rio-Rodriguez et al., 2021).\nВозможность нокардиоза важно учитывать, но без подтверждённой выборки нельзя утверждать, что большинство крупных ветвящихся палочек у пресноводных рыб — нокардии.\nА различаются ли они по патогенности? Оба рода содержат возбудителей опасных заболеваний рыб. Микобактериоз обычно протекает как хроническая, нередко постепенно прогрессирующая инфекция с гранулематозными поражениями. Нокардиоз тоже может быть хроническим и системным, но способен вызывать массовую гибель в аквакультуре. Поэтому правило «микобактерии опасные, нокардии менее опасные» не работает.\nПри экспериментальном заражении большеротого окуня разными изолятами Nocardia seriolae в исследовании Zhang и соавторов (2024) смертность в изученных группах составляла 70–100%. Это показатель патогенности конкретных изолятов при заданных условиях опыта, а не прогноз для каждой заражённой рыбы (Zhang et al., 2024).\nЗначит, и размеры гранулём, и тяжесть поражения органов, и количество ветвящихся структур нельзя превращать в простой определитель рода. Нужны сведения о хозяине, течении заболевания и результатах подтверждающих исследований.\nА с резистентностью что? Здесь важно не смешивать две совершенно разные устойчивости:\nКислотоустойчивость при окрашивании — способность удерживать фуксин после воздействия деколоризатора. Именно это мы проверяем по Цилю — Нильсену и его модификациям. Устойчивость к антимикробным препаратам — способность бактерии сохранять рост при воздействии определённого вещества. Её оценивают отдельно, например по минимальной подавляющей концентрации (МПК), с учётом применимости метода и критериев интерпретации. Различия в клеточной оболочке могут влиять на оба явления, но по степени кислотоустойчивости нельзя рассчитать чувствительность к антибиотикам.\nУ N. seriolae это хорошо видно по исследованиям изолятов рыб. В работе Zhang и соавторов (2024) исследованный высокопатогенный штамм проявлял устойчивость к ряду β-лактамов, но чувствительность к некоторым другим препаратам. В исследовании Nguyen и соавторов (2026) у 13 изолятов обнаружили снижённую чувствительность к триметоприму-сульфаметоксазолу относительно использованных порогов; для ряда других веществ результаты были благоприятнее (Zhang et al., 2024) (Nguyen et al., 2026). Критерии и методики разных работ могут отличаться, поэтому переносить цифры на любого возбудителя нельзя.\nИ даже чувствительность in vitro не равна эффективности лечения в аквариуме. При системной гранулематозной инфекции важны поражение органов, доступность препарата в очагах, состояние рыбы и ограничения конкретной аквариумной системы. Для микобактериоза рыб общепринятого эффективного лечения, обеспечивающего устранение инфекции, не установлено (Merck Veterinary Manual).\nОт морфологии мы переходим к гипотезе о возбудителе; от идентификации — к оценке его патогенности и чувствительности. Не наоборот.\nТри ступени описания Наблюдение. В мазке-отпечатке видны палочковидные и нитевидные структуры с предполагаемым ветвлением. Проверенное свойство. Указываем конкретный метод окрашивания и наличие либо отсутствие кислотного обесцвечивания. Только после соответствующей проверки можно говорить о кислотоустойчивости в этих условиях. Идентификация. Для утверждения Mycobacterium или Nocardia нужны дополнительные основания: культуральное исследование, молекулярная диагностика или другие валидированные данные. Ветвление помогает выбрать направление поиска. Окраска показывает реакцию на конкретную обработку. Идентификация требует отдельного доказательства.\nПодробнее с первичными исследованиями и сравнением методик: F.O.S. — полный разбор «Веточки и палочки».\nЛитература Brown-Elliott, B.A., Brown, J.M., Conville, P.S., Wallace, R.J. Jr., 2006. Clinical and Laboratory Features of the Nocardia spp. Based on Current Molecular Taxonomy. Clinical Microbiology Reviews, 19(2), 259–282. https://pmc.ncbi.nlm.nih.gov/articles/PMC1471991/\nGrowth Characteristics and Morphological Changes of Fish Pathogen Nocardia seriolae in Submerged Culture, 2010. Aquaculture Science, 58, 429–431. https://doi.org/10.11233/aquaculturesci.58.429\ndel Rio-Rodriguez, R.E., et al., 2021. First evidence of fish nocardiosis in Mexico caused by Nocardia seriolae in farmed red drum (Sciaenops ocellatus, Linnaeus). Journal of Fish Diseases, 44, 1117–1130. https://doi.org/10.1111/jfd.13373\nZhang, W. et al., 2024. Biological characteristics and pathogenicity comparison of Nocardia seriolae isolated from Micropterus salmoides and Channa argus. Frontiers in Veterinary Science, 11, 1367066. https://doi.org/10.3389/fvets.2024.1367066\nNguyen, A.T. et al., 2026. First Report of Nocardiosis Caused by Nocardia seriolae in Farmed Spotted Scat (Scatophagus argus). Journal of Fish Diseases, 49(9), e70171. https://doi.org/10.1111/jfd.70171\nPetty, B.D., Francis-Floyd, R., Yanong, R.P.E., 2024. Bacterial Diseases of Fish. Merck Veterinary Manual. https://www.merckvetmanual.com/exotic-and-laboratory-animals/aquarium-fish/bacterial-diseases-of-fish\n","permalink":"https://fossamethod.ru/ru/fo/twigs_and_sticks/","summary":"Почему форма не определяет возбудителя, чем опасен нокардиоз и как не спутать кислотоустойчивость с антибиотикорезистентностью.","title":"Веточки и палочки. Что говорят форма и окраска?"},{"content":" Выберите препарат Нажмите на любой препарат для просмотра — Загрузка панорамы… Аннотации: Выкл Коллекция препаратов ","permalink":"https://fossamethod.ru/ru/microscope-app/","summary":"Полноширинный интерфейс виртуального микроскопа с панорамами DZI и аннотациями.","title":"Виртуальный микроскоп — широкий режим"},{"content":"\nГлубина разбора F. F.O. F.O.S. Рыбий плавник кто-то «съел»? У рыбы был красивый ровный плавник. Потом его край стал неровным, будто обтрёпанным. Ещё через некоторое время отдельные лучи начали торчать в разные стороны, а сам плавник укоротился.\n«Плавниковая гниль», — скажут в аквариумном чате. И почти наверняка посоветуют средство от бактерий.\nТолько что мы на самом деле узнали? Мы увидели повреждённый плавник. Но не увидели причину повреждения.\nСлово «гниль» звучит так, будто кто-то уже выяснил, что ткани разрушают микроорганизмы. Между тем похожий вид может появиться после травмы, при некоторых неинфекционных нарушениях и при настоящей бактериальной инфекции.\nОбтрёпанный плавник — это признак повреждения, а не название его причины.\nПосмотрим на плавник поближе Строение плавниковых лучей. A — сегментированные лепидотрихии. B — поперечное сечение лепидотрихия с двумя полусегментами. Плавник не похож на сплошную пластинку. Его поддерживают тонкие лучи, состоящие из множества соединённых друг с другом частей. Между лучами расположены мягкие ткани.\nПод увеличением это особенно хорошо заметно.\nА теперь возьмём уже повреждённый луч и осторожно коснёмся его препаровальной иглой. Посмотри, что происходит.\nВаш браузер не поддерживает видео. Как расходятся элементы повреждённого плавникового луча Луч словно разбирается на отдельные части. При этом на исследуемом участке можно различить и сохранившиеся мягкие ткани.\nПохоже, будто мы поймали момент разрушения плавника. Но есть одна тонкость: игла показывает, как расходятся уже повреждённые элементы. Она не показывает, что повредило их раньше.\nМожет быть, рыба травмировалась. Может быть, сначала пострадали окружающие ткани. А может быть, действительно развивалась инфекция. По одному этому опыту выбрать ответ нельзя.\nА без бактерий плавник может разрушиться? Да. Учёные исследовали золотых рыбок, живших на участке реки, куда попадали стоки целлюлозно-бумажного производства. У рыб разрушались плавники, но выраженного участия бактерий в этом процессе не обнаружили.\nИсследование тканей показало, что изменения начинались с наружного покрова плавника, затем затрагивали более глубокие ткани и сами лучи. Это один из описанных примеров неинфекционной эрозии плавников — fin erosion (\rSharples \u0026amp; Evans, 1996).\nА бывают и противоположные случаи. Например, при колумнариозе бактерии действительно способны вызывать поражения кожи, жабр и плавников (\rDeclercq et al., 2013).\nПолучается, оба варианта реальны. Ошибка — объявлять один из них единственным объяснением любого обтрёпанного плавника.\nТак что делать, если плавники разрушаются? Сначала разобраться, что происходит с рыбой и аквариумом.\nПосмотри, когда появились изменения и насколько быстро они развиваются. Есть ли травмы, преследование соседями, опасные детали оборудования? Пострадала одна рыба или сразу несколько? Не изменились ли параметры воды, фильтрация и условия содержания?\nЕсли доступен микроскоп, полезно исследовать повреждённый участок: какие ткани сохранились, есть ли признаки воспаления и что видно среди микроорганизмов. Но и обнаруженные бактерии ещё не отвечают автоматически на вопрос, появились ли они до повреждения или заселили ткани после него.\nНе стоит подбирать антибактериальное лечение только по виду плавника. Сначала нужно понять, имеются ли основания подозревать бактериальное заболевание.\nЧто мы узнали Мы начали с привычного названия — «плавниковая гниль». Потом посмотрели на строение луча и увидели, как его части расходятся при воздействии иглой.\nНо самое важное произошло не под микроскопом. Мы отделили то, что действительно наблюдали, от того, что только предполагаем.\nПлавник разрушен — это факт. Почему он разрушен — вопрос, который ещё нужно исследовать.\nЕсли хочется разобраться глубже: F.O. — как устроены плавниковые лучи и чем эрозия отличается от инфекции · F.O.S. — полный научный разбор с исследованиями.\n","permalink":"https://fossamethod.ru/ru/f/finerosion/","summary":"Обтрёпанный плавник принято сразу называть гнилью. Но что мы действительно видим и почему это не готовый диагноз?","title":"Обтрёпанные плавники. Кто виноват?"},{"content":"\nГлубина разбора F. F.O. F.O.S. «Плавниковая гниль»: диагноз или описание внешнего вида? Неровные края плавников, укороченные лучи, побелевшие участки и разрушение перепонок часто объединяют привычным названием «плавниковая гниль». В разговоре это удобно. Но в диагностике возникает проблема: само название уже подсказывает инфекционную причину, хотя мы могли наблюдать только повреждение ткани.\nОдно и то же внешнее изменение может быть связано с травмой, неинфекционным патологическим процессом или бактериальной инфекцией. Причём варианты не всегда исключают друг друга: к ранее повреждённым тканям могут присоединиться микроорганизмы.\nПоэтому полезно начать с трёх отдельных вопросов: что повреждено, как развивается повреждение и чем оно вызвано?\nРазрушение плавника — морфологический признак. Бактериальная инфекция — одна из возможных причин. Одно не следует автоматически из другого.\nИз чего состоит плавниковый луч Строение плавниковых лучей. A — сегментированные лепидотрихии. B — поперечное сечение лепидотрихия с двумя полусегментами. Опорные структуры плавников костистых рыб называются лепидотрихиями. Это сегментированные лучи, а не цельные стержни. Каждый лепидотрихий образован двумя изогнутыми полусегментами. Последовательные сегменты вдоль луча соединяются связками; между полусегментами находятся соединительная ткань, сосуды и нервы. Вокруг расположены мягкие ткани плавника (\rSharples \u0026amp; Evans, 1996).\nСочетание твёрдых элементов и мягких соединений делает луч одновременно гибким и прочным. Но при повреждении связей между его частями возможны расхождение сегментов, расслоение и фрагментация. Это не обязательно означает, что бактерии непосредственно разрушают каждый из этих элементов.\nЧто демонстрирует препаровальная игла Ваш браузер не поддерживает видео. Расслоение повреждённого плавникового луча под бинокуляром На видео игла воздействует на уже повреждённый луч. Его отдельные элементы расходятся вдоль соединений, а часть мягких тканей на исследуемом участке сохраняется. Здесь необходимо разделить два вывода.\nНаблюдение: элементы повреждённого луча способны расходиться при механическом воздействии, то есть мы видим конкретный характер разрушения его структуры.\nНеустановленная причина: почему ткани и их соединения были повреждены до воздействия иглой. Для этого нужны данные о рыбе, условиях содержания и характере поражения. Опыт показывает механизм расхождения элементов при воздействии, но не доказывает ни инфекционную, ни неинфекционную природу исходного поражения.\nЭрозия плавников без первичной бактериальной инфекции В литературе встречается термин fin erosion — эрозия плавников. Он описывает разрушение тканей плавника, но само слово «эрозия» ещё не определяет этиологию: при инфекционных заболеваниях тоже может наблюдаться эрозия.\nОсобенно наглядна работа Sharples и Evans (1996). Авторы изучали повреждения плавников у золотых рыбок (Carassius auratus) на участке реки, подвергавшемся воздействию стоков целлюлозно-бумажного производства. Исследование тканей позволило проследить последовательность изменений.\nСначала повреждались наружные структуры эпидермиса: утрачивались поверхностные элементы, возникало слущивание клеток. Позже отмечались изменения глубжележащих тканей и лепидотрихий. Выраженного участия бактерий в большинстве исследованных поражений не выявили; обнаруженные бактерии рассматривались как вероятно вторичные (\rSharples \u0026amp; Evans, 1996).\nЧто подтверждает этот пример? Разрушение плавника возможно без установленной первичной бактериальной инфекции. Это не доказательство, что все похожие повреждения возникают по тому же механизму или обязательно связаны с загрязнением воды.\nА если проблема в питании или состоянии организма? Состояние плавников зависит не только от твёрдых лучей. Важны сохранность эпителия, соединительной ткани и сосудов, питание тканей и способность к восстановлению.\nНарушения рациона, минерального обмена и общего физиологического состояния могут быть обоснованными направлениями диагностического поиска. Однако здесь легко сделать ещё один преждевременный вывод: увидеть повреждённые кончики плавников и сразу объяснить их «плохой трофикой».\nНарушение трофики — гипотеза, требующая проверки, а не название любой неинфекционной эрозии. В частности, общие данные о минеральном обмене рыб не доказывают, что дистальные участки плавников обязательно повреждаются первыми из-за недостаточного кровоснабжения (\rLall \u0026amp; Kaushik, 2021).\nОтсутствие доказанной бактериальной причины не является доказательством какой-то одной неинфекционной причины.\nКогда бактерии участвуют в разрушении плавников Бактерии, встречающиеся при инфекционном разрушении плавников. Слева — нитевидные формы, справа — мелкие палочковидные бактерии. Бактериальные заболевания плавников существуют. При колумнариозе, связанном с бактериями группы Flavobacterium columnare, описаны поражения кожи, жабр и плавников, в том числе их эрозия (\rDeclercq et al., 2013). В подобных случаях микроорганизмы могут быть непосредственными участниками патологического процесса.\nНо существуют и вторичные бактериальные процессы. Сначала ткань повреждается по другой причине, затем микроорганизмы заселяют изменённую поверхность. Это ожидаемо: рыба постоянно контактирует с разнообразной микрофлорой, а слизь и эпителий участвуют в местной защите (\rGomez et al., 2013).\nДля интерпретации микроскопической картины важно не только наличие бактерий, но и их распределение, связь с повреждёнными тканями, признаки воспаления и динамика заболевания. Наличие большого количества бактерий на разрушенном участке не позволяет автоматически восстановить последовательность событий.\nДва разных сценария Первичное бактериальное поражение: микроорганизмы участвуют в запуске и развитии повреждения тканей.\nВторичная колонизация: поражение возникло раньше, а бактерии размножаются на уже изменённой поверхности и могут дополнительно осложнять процесс.\nОба сценария возможны. В конкретном случае нужно выяснить, какой из них лучше объясняет наблюдения.\nПрактический разбор: с чего начать Вместо немедленного назначения «средства от плавниковой гнили» полезно последовательно оценить несколько вещей:\nМорфология. Какие структуры разрушены: края перепонки, отдельные лучи или основание плавника? Есть ли покраснение, налёт, слизь, некроз, кровоизлияния? Динамика. Повреждение возникло быстро или нарастало постепенно? Продолжает ли прогрессировать? Распределение. Пострадала одна рыба, определённый вид или многие рыбы в общей системе? Среда и травмы. Не было ли изменений воды, фильтрации, оборудования, пересадок, драк или повреждений при отлове? Микроскопия. Что происходит с мягкими тканями? Какие микроорганизмы обнаруживаются и как они связаны с поражённым участком? Если данные указывают на инфекционный процесс, для уточнения возбудителя могут потребоваться целенаправленный отбор материала, посев, молекулярные исследования или гистология. Однако даже когда такие методы недоступны, описание ткани, микроскопия и анализ условий содержания позволяют сузить круг объяснений.\nВажно понимать и пределы исследования: увидеть бактерии не значит установить их причинную роль, а отсутствие бактерий в отдельном препарате не исключает инфекцию полностью.\nОт наблюдения к диагнозу Можно зафиксировать: «Край хвостового плавника неровный, отдельные лучи укорочены, перепонка между ними разрушена».\nМожно предположить: «Поражение совместимо с эрозией плавника; необходимо оценить травматические, средовые и инфекционные причины».\nНо утверждение «это бактериальная плавниковая гниль» требует самостоятельных оснований, а не только внешнего сходства.\nДиагноз должен объяснять происхождение повреждения, а не просто повторять его внешний вид другим словом.\nСначала описываем разрушение плавника. Затем проверяем возможные механизмы. И только после этого решаем, какое лечение действительно необходимо.\nИсточники Sharples, A. D., Evans, C. W. (1996). Pathology of fin erosion in goldfish Carassius auratus. Diseases of Aquatic Organisms, 24, 81–91. https://doi.org/10.3354/dao024081 Declercq, A. M. et al. (2013). Columnaris disease in fish: a review with emphasis on bacterium-host interactions. Veterinary Research, 44, 27. https://doi.org/10.1186/1297-9716-44-27 Gomez, D., Sunyer, J. O., Salinas, I. (2013). The mucosal immune system of fish: the evolution of tolerating commensals while fighting pathogens. Fish \u0026amp; Shellfish Immunology, 35, 1729–1739. https://doi.org/10.1016/j.fsi.2013.09.032 Lall, S. P., Kaushik, S. J. (2021). Nutrition and metabolism of minerals in fish. Animals, 11, 2711. https://doi.org/10.3390/ani11092711 Другие уровни: F. — простая история про обтрёпанные плавники · F.O.S. — полный разбор и исходные исследования.\n","permalink":"https://fossamethod.ru/ru/fo/finerosion/","summary":"От внешнего признака к механизму: что показывает расслоение лепидотрихий, когда бактерии вызывают поражение и как проверять альтернативные причины.","title":"Разрушение плавников: эрозия, инфекция и строение лучей"},{"content":"\n«Ценой миллиардов жизней человек завоевал свой иммунитет —\nсвоё право жить на этой планете среди других организмов».\r«Война миров» (2005), финальный монолог.\rПрезентация по теме\rПоказания и ограничения к применению лекарственных препаратов в аквариумных системах\rЗдоровым часто называют организм, в котором не обнаружено ничего «плохого»: паразитов, бактерий, грибов, повреждений или отклонений от условной нормы. Но живой организм не существует отдельно от среды. Его поверхность, жабры, кишечник и даже внутренние ткани постоянно взаимодействуют с другими организмами. Поэтому абсолютная стерильность не является естественным состоянием животного (Gomez et al., 2013).\nЗдоровье — это не отсутствие любых чужеродных организмов. Это способность сохранять функции, поддерживать внутреннее равновесие и компенсировать воздействие среды без выраженного нарушения состояния.\nОрганизм может быть заражён, но не быть больным.\nПрисутствие возбудителя не равно болезни Обнаружение паразита или бактерии отвечает только на один вопрос: этот организм присутствует в исследованном материале. Оно ещё не показывает:\nвызывает ли он наблюдаемые изменения; насколько велика его численность; способен ли хозяин контролировать его воздействие; является ли он основной причиной нарушения; требуется ли немедленное лечение. Одна инфузория на поверхности рыбы и десятки тысяч инфузорий на коже и жабрах — биологически совершенно разные ситуации, хотя название находки будет одинаковым.\nВ природной среде рыбы регулярно несут небольшое количество наружных паразитов. Их обнаружение не означает, что каждая такая рыба находится в состоянии заболевания. Иначе значительная часть диких животных должна была бы постоянно демонстрировать тяжёлые клинические признаки.\nГраница между носительством и заболеванием проходит не по факту присутствия возбудителя, а по последствиям его присутствия.\nБолезнь начинается не тогда, когда появился паразит, а тогда, когда его воздействие превысило возможности хозяина.\nИммунитет контролирует, но не обязательно уничтожает Иммунную систему часто представляют как армию, задача которой — найти и полностью уничтожить всё чужеродное. Но полная и непрерывная мобилизация против каждого микроорганизма была бы слишком затратной и опасной для самого хозяина.\nЗащитная реакция требует энергии, изменяет кровообращение, усиливает образование слизи, привлекает клетки воспаления и может повреждать собственные ткани. Поэтому организм не обязан отвечать одинаково сильно на единичного паразита и на массивное заражение.\nВо многих случаях результатом иммунного ответа становится не стерильность, а контролируемое сосуществование (Luo et al., 2007; Bai et al., 2008; Yin et al., 2015):\nчисленность паразита остаётся низкой; повреждение тканей ограничено; функции органов сохраняются; клинические признаки отсутствуют или минимальны. Это не провал иммунитета. Напротив, поддержание равновесия может быть более выгодным, чем разрушительная попытка уничтожить всё до последней клетки.\nЗащитная реакция тоже имеет цену Слизь защищает кожу и жабры рыбы. Но усиленное слизеобразование может одновременно мешать газообмену, задерживать паразитов, бактерии и клеточный детрит. Воспаление ограничивает инфекцию, но выраженный отёк и клеточная инфильтрация повреждают ткани. Слущивание эпителия помогает удалить поражённый слой, но нарушает целостность покровов (Dash et al., 2018).\nПоэтому выраженность защитной реакции не всегда отражает количество возбудителя напрямую. У чувствительного вида даже сравнительно небольшая инвазия может вызвать бурное помутнение кожи, усиленное дыхание и изменение поведения. Другая рыба при той же численности паразитов может внешне оставаться почти нормальной (Yin et al., 2018).\nПолучается, что тяжесть состояния определяется не только агрессивностью паразита, но и тем, как именно организм на него отвечает.\nИногда животное повреждает не только возбудитель, но и чрезмерная попытка организма от него защититься.\nАквариум превращает присутствие в заболевание\nВ природе сошедший с рыбы паразит оказывается в огромном объёме воды. Его следующая стадия может не встретить подходящего хозяина, быть унесена течением, погибнуть или осесть далеко от рыбы.\nВ аквариуме всё происходит иначе:\nобъём воды ограничен; плотность животных высока; одни и те же поверхности используются многократно; сошедшие стадии накапливаются рядом с хозяином; течение возвращает их в зону, где находятся кожа и жабры рыб; одна и та же рыба снова встречается с потомством паразитов, которые недавно находились на ней самой. Паразит, который в природе существовал на уровне незначительного носительства, в замкнутой системе получает возможность многократно повторять цикл на одних и тех же животных.\nПоэтому заболевание в аквариуме нередко связано не с появлением принципиально нового возбудителя, а с изменением пространства, плотности и вероятности повторного контакта.\nАквариум не просто содержит рыбу и паразита. Он изменяет вероятность их встречи (How et al., 2015).\nОтсутствие признаков не доказывает отсутствие паразита После лечения рыба может выглядеть чистой, нормально дышать и принимать корм. Это важный клинический результат. Но он не доказывает, что на рыбе или в системе не осталось ни одной жизнеспособной стадии. Приобретённая защита способна резко снизить интенсивность последующего заражения и клинические последствия инвазии (Luo et al., 2007; Yin et al., 2015).\nМы видим болезнь только после превышения определённого порога. Пока паразитов мало, они могут:\nне вызывать заметного помутнения кожи; не приводить к выраженной гиперсекреции слизи; обнаруживаться в ограниченном соскобе; сохраняться в складках, под чешуёй, в жабрах или других труднодоступных участках; передаваться между рыбами с интенсивностью ниже клинического порога. Следовательно, исчезновение симптомов означает восстановление состояния животного, но не обязательно абсолютную элиминацию возбудителя.\nНиже порога обнаружения — не значит равно нулю.\nНе каждую находку нужно немедленно уничтожать Когда в соскобе обнаруживают инфузорию, бактерию или гриб, естественной реакцией становится желание сразу внести препарат. Но решение должно зависеть не только от названия найденного организма.\nНеобходимо учитывать:\nсостояние рыбы; интенсивность заражения; локализацию поражения; динамику; восприимчивость вида; качество воды; возможность непосредственной обработки; риск самого лечения; последствия для всей системы. Единичная находка у нормально ведущей себя рыбы и массивное поражение животного, которое тяжело дышит и перестало питаться, не должны автоматически приводить к одной и той же схеме (Yin et al., 2018).\nЛекарство необходимо не потому, что в системе присутствует другая жизнь, а потому, что без вмешательства ожидается дальнейшее повреждение животного.\nРана в воде остаётся раной — но вода не делает её катастрофой Повреждение кожи рыбы постоянно контактирует с водой. Для человека это выглядит необычно: собственные раны мы стараемся защитить от загрязнения и длительного намокания. Из-за этого сама картина раны в воде может восприниматься как неотложная угроза.\nНо рыба эволюционно приспособлена к такой среде. Небольшая чистая рана при нормальных условиях может закрыться самостоятельно. Не каждое повреждение требует антибиотика, антисептика во всей системе или продолжительного курса препаратов.\nСначала нужно выяснить:\nпродолжается ли разрушение ткани; есть ли некроз; нарастает ли воспаление; появился ли грибной или бактериальный налёт; ухудшается ли общее состояние; можно ли очистить очаг непосредственно. Если патологический материал доступен, его можно убрать. Если рана чистая и заживает, иногда лучшим действием будет нормальная вода и наблюдение.\nЛечить нужно нарушение равновесия Сам факт существования паразитов, бактерий и грибов не является ошибкой природы. Хозяин и окружающие его организмы формировались в постоянном взаимодействии. Иммунитет, покровы, слизь, поведение и способы восстановления тканей возникли именно в мире, который никогда не был стерильным.\nПоэтому цель лечения не должна формулироваться как уничтожение всей другой жизни вокруг животного.\nЦель — вернуть систему в состояние, при котором:\nрыба сохраняет жизнеспособность; повреждение не нарастает; паразитарная или бактериальная нагрузка контролируется; повторное заражение ограничено; лечение не создаёт большего вреда, чем исходная проблема. Лечить следует не присутствие другой жизни, а нарушение равновесия, при котором это присутствие становится опасным.\nЛитература Bai J. S., Xie M. Q., Zhu X. Q., Dan X. M., Li A. X. 2008. Comparative studies on the immunogenicity of theronts, tomonts and trophonts of Cryptocaryon irritans in grouper. Parasitology Research, 102(2): 307–313. https://doi.org/10.1007/s00436-007-0766-6\nDash S., Das S. K., Samal J., Thatoi H. N. 2018. Epidermal mucus, a major determinant in fish health: a review. Iranian Journal of Veterinary Research, 19(2): 72–81. PMID: 30046316; PMCID: PMC6056142.\nGomez D., Sunyer J. O., Salinas I. 2013. The mucosal immune system of fish: the evolution of tolerating commensals while fighting pathogens. Fish \u0026amp; Shellfish Immunology, 35(6): 1729–1739. https://doi.org/10.1016/j.fsi.2013.09.032\nHow K. H., Zenke K., Yoshinaga T. 2015. Dynamics and distribution properties of theronts of the parasitic ciliate Cryptocaryon irritans. Aquaculture, 438: 170–175. https://doi.org/10.1016/j.aquaculture.2014.12.013\nLuo X. C., Xie M. Q., Zhu X. Q., Li A. X. 2007. Protective immunity in grouper (Epinephelus coioides) following exposure to or injection with Cryptocaryon irritans. Fish \u0026amp; Shellfish Immunology, 22(4): 427–432. https://doi.org/10.1016/j.fsi.2006.04.011\nYin F., Sun P., Tang B., Dan X., Li A. 2015. Immunological, ionic and biochemical responses in blood serum of the marine fish Trachinotus ovatus to poly-infection by Cryptocaryon irritans. Experimental Parasitology, 154: 113–117. https://doi.org/10.1016/j.exppara.2015.04.010\nYin F., Liu W., Bao P., Jin S., Qian D., Wang J., Tang B. 2018. Comparison of the susceptibility and resistance of four marine perciform fishes to Cryptocaryon irritans infection. Fish \u0026amp; Shellfish Immunology, 77: 298–303. https://doi.org/10.1016/j.fsi.2018.03.052\n","permalink":"https://fossamethod.ru/ru/posts/health-is-not-sterility/","summary":"Здоровье — это не отсутствие всех микроорганизмов и паразитов, а способность организма сохранять функции и устойчивость при постоянном взаимодействии со средой.","title":"Здоровье не означает стерильность"},{"content":"\rПри криптокарионозе возможны по меньшей мере две клинические ситуации. В первой паразит обнаружен рано: его численность ещё невелика, рыба сохраняет нормальное дыхание, поведение и аппетит. В этом случае есть время воздействовать на свободноживущие стадии паразита в воде, контролировать концентрацию препарата и постепенно снижать заражённость системы.\nВо второй ситуации болезнь уже выражена. Рыба тяжело дышит, покрыта большим количеством слизи и паразитов, отказывается от корма и может погибнуть раньше, чем обработка воды даст результат.\nЭти ситуации не противопоставлены друг другу. Успешная помощь тяжело больной рыбе должна перевести её из второго состояния в первое: сначала быстро уменьшить паразитарную нагрузку и восстановить жизненно важные функции, а затем продолжить обработку системы и уничтожение оставшихся стадий паразита.\nЭта страница посвящена именно второй ситуации — когда рыбе плохо уже сейчас. Почему присутствие паразита не всегда означает болезнь и почему здоровье не равно стерильности\rЗдоровье не означает стерильность\rПочему присутствие микроорганизмов и паразитов не всегда означает болезнь, иммунитет не обязан уничтожать их полностью, а применение …\rЧто делать, если рыба может погибнуть раньше, чем подействует препарат в воде? Внесение меди в воду не удаляет трофонтов с кожи и жабр немедленно. Даже правильно рассчитанная и контролируемая концентрация действует в рамках жизненного цикла паразита и требует времени (Zec et al., 2021).\nДля системы это может быть обоснованным лечением. Для задыхающейся рыбы — слишком медленным первым действием.\nРечь не идёт об отказе от меди или других методов обработки воды. Речь идёт о последовательности действий. Если состояние рыбы тяжёлое, ожидание действия препарата не должно заменять непосредственную помощь животному.\nПоэтому лечение необходимо разделить на два этапа:\nНемедленная помощь рыбе и быстрое снижение паразитарной нагрузки; Последующий контроль паразита в воде и предотвращение повторного заражения. Сначала уменьшить нагрузку на рыбу Тяжесть состояния определяется не только самим фактом заражения, но и количеством паразитов, находящихся на коже и жабрах в данный момент. Чем выше эта нагрузка, тем сильнее раздражение покровов, образование слизи, повреждение эпителия и нарушение дыхания (Kaige \u0026amp; Miyazaki, 1985; Cervera et al., 2022).\nПоэтому при тяжёлом состоянии первая задача состоит не в том, чтобы немедленно уничтожить каждого паразита в системе, а в том, чтобы быстро уменьшить их количество непосредственно на рыбе.\nДаже неполное удаление паразитов может существенно изменить ситуацию. Если на коже и жабрах остаётся не тысяча паразитов, а несколько сотен, иммунная система, покровы и органы дыхания получают время для восстановления. Рыба может начать лучше дышать, сохранять равновесие и пережить период, необходимый для дальнейшего лечения.\nПолное уничтожение паразита может потребовать времени.\nСнижение нагрузки на рыбу должно начаться сразу.\nДля этого могут использоваться методы, воздействующие непосредственно на поверхность тела:\nКратковременная ванна в подходящем растворе; Промывание; Удаление избыточной патологически изменённой слизи; Осторожное механическое очищение доступных участков кожи; Обработка отдельных очагов; Перенос рыбы в чистую ёмкость после процедуры. Выбор метода зависит от вида рыбы, состояния её покровов, локализации поражения и способности животного перенести фиксацию и обработку.\nРечь не идёт о грубом соскабливании нормального эпителия. Удаляется прежде всего материал, который уже перестал выполнять защитную функцию: скопления паразитов, рыхлая слизь, отслаивающийся эпителий и поверхностные патологические наложения.\nПодробнее: непосредственная обработка рыбы и механическое удаление наружных паразитов\rПростые правила при работе с аквариумной рыбой\rБазовые рекомендации по диагностике и уходу за аквариумными рыбами: что делать при падеже, как интерпретировать аппетит, когда лечить …\rПочему паразиты появляются на рыбе волнами Трофонты Cryptocaryon irritans питаются и растут на коже и жабрах рыбы. После завершения этой стадии они покидают хозяина, оседают на поверхностях и переходят к дальнейшему развитию вне рыбы (Colorni \u0026amp; Diamant, 1993; Ma et al., 2016).\nВ аквариуме эти стадии не исчезают. Они накапливаются на дне, стенках, оборудовании и других поверхностях. После деления из них выходят новые инфекционные стадии, которые снова ищут хозяина. Наибольшую опасность представляют недавно вышедшие теронты: по мере старения их подвижность и способность заражать рыбу быстро снижаются (Yoshinaga \u0026amp; Dickerson, 1994; Chi et al., 2020).\nПоэтому количество видимых паразитов на рыбе может изменяться волнообразно:\nЧасть трофонтов покидает рыбу, и внешне её состояние временно улучшается; Вне хозяина продолжается развитие паразита; Из накопившихся стадий выходит новое поколение; Рыба заражается повторно, нередко значительно сильнее, чем раньше. Временное уменьшение числа точек на рыбе не обязательно означает прекращение заболевания.\nОно может отражать переход паразита к следующей стадии жизненного цикла (Li et al., 2022).\nРыба остаётся рядом с местом развития паразита После отделения от хозяина часть стадий Cryptocaryon irritans оседает, прикрепляется к поверхностям аквариума и продолжает развитие вне рыбы (Colorni, 1985; Colorni \u0026amp; Diamant, 1993). При этом рыбы могут длительное время находиться непосредственно у дна — всего в нескольких сантиметрах от скоплений паразита. В такой ситуации хозяин фактически остаётся рядом с местом выхода следующего поколения инфекционных стадий. Ограниченный объём воды и небольшое расстояние повышают вероятность повторного заражения.\nРыбы находятся непосредственно у дна аквариума — рядом с поверхностью, на которой оседают и продолжают развитие стадии Cryptocaryon irritans. Чашки Петри после экспозиции на дне аквариума. Видимые отложения содержали многочисленные прикреплённые стадии Cryptocaryon irritans. То, что покинуло рыбу, остаётся в системе. При содержании заражённых рыб на дне аквариума были установлены чашки Петри. На их поверхности накапливался материал, который внешне мог выглядеть как обычный осадок или загрязнение. При увеличении в составе этого материала обнаруживались многочисленные прикреплённые стадии Cryptocaryon irritans.\nСкопления прикреплённых стадий На поверхности чашек паразиты располагались не только поодиночке, но и плотными многослойными скоплениями. Такие участки образовывали плёнки, которые без увеличения можно было принять за обычный органический налёт.\nПлотное многослойное скопление прикреплённых стадий Cryptocaryon irritans. Отдельные образования формируют сплошные участки налёта. Прикреплённые стадии Cryptocaryon irritans на поверхности чашки Петри. При большем увеличении При исследовании на просвет хорошо различимы округлые и овальные образования, окружённые оболочкой. Внутреннее содержимое отдельных стадий неоднородно, что соответствует продолжающемуся развитию паразита вне хозяина.\nСкопление инцистированных стадий Cryptocaryon irritans при исследовании на просвет. Инцистированные стадии Cryptocaryon irritans при большем увеличении. Различимы наружная оболочка и неоднородное внутреннее содержимое. Паразиты удаляются вместе со слизью При усиленном отделении патологически изменённой слизи паразиты покидали поверхность рыбы вместе с плотными слизистыми массами и клетками слущенного эпителия. В таком материале они обнаруживались в большом количестве и часто образовывали компактные скопления.\nСкопление Cryptocaryon irritans в плотной слизи и слущенном эпителии, удалённых с поверхности рыбы. Паразиты в составе отделившейся слизисто-клеточной массы. Удаление патологически изменённой слизи одновременно уменьшает паразитарную нагрузку на поверхности рыбы. То, что внешне выглядит как слизь, осадок или плёнка на поверхности, может содержать большое количество жизнеспособных стадий паразита.\nПаразиты, покинувшие рыбу, не исчезают. Часть из них остаётся в слизи и слущенном эпителии, часть прикрепляется к поверхностям аквариума и продолжает развитие вне хозяина. Поэтому временное очищение кожи ещё не означает прекращения жизненного цикла: без удаления накопившегося материала рыба вскоре снова оказывается рядом с новым поколением инфекционных стадий (Burgess \u0026amp; Matthews, 1994).\nЭти наблюдения показывают простую вещь: снижение количества паразитов на рыбе не означает их исчезновения. Значительная часть жизненного цикла продолжается рядом с хозяином — в пределах той же ограниченной системы.\nСхема действий: очистить рыбу и разобщить её с паразитом Если рыба уже тяжело заражена, лечение должно одновременно решать две задачи:\nбыстро уменьшить количество паразитов на коже и жабрах; не позволить рыбе сразу встретиться с новым поколением инфекционных стадий. Препарат, внесённый в воду, не удаляет трофонтов с рыбы мгновенно. Его действие направлено прежде всего на свободноживущие стадии паразита. Поэтому при тяжёлом состоянии ожидание эффекта от обработки воды может оказаться слишком медленным.\nСначала необходимо очистить рыбу от того, что находится на ней сейчас. Затем — отделить её от того, что осталось в системе.\n1. Непосредственная обработка рыбы Если вид рыбы переносит кратковременное пребывание в пресной воде, её можно использовать для промывания поверхности тела и снижения паразитарной нагрузки.\nПродолжительность процедуры определяется состоянием и видовой чувствительностью рыбы. Это не должна быть ванна, которую животное обязано «выдержать» любой ценой. Иногда достаточно нескольких минут, в течение которых рыбу можно осторожно промывать, удаляя отделяющуюся слизь и поверхностно расположенный патологический материал.\nПри выраженном поражении однократной процедуры может быть недостаточно. После первого воздействия через несколько часов может начаться усиленное отделение слизи и слущенного эпителия. В таком случае рыбу можно промыть повторно, удаляя материал, который уже отделился от поверхности тела.\nПодробнее: непосредственная обработка рыбы и механическое удаление наружных паразитов\rПростые правила при работе с аквариумной рыбой\rБазовые рекомендации по диагностике и уходу за аквариумными рыбами: что делать при падеже, как интерпретировать аппетит, когда лечить …\rНевозможность удалить всех паразитов за одну процедуру не является причиной оставлять на рыбе всех паразитов.\n2. Не возвращать очищенную рыбу к накопившимся стадиям После промывания рыбу необходимо поместить в чистую ёмкость. Возвращение её в тот же необработанный аквариум сразу восстанавливает контакт с цистами, слизью, слущенным эпителием и выходящими из них инфекционными стадиями.\nВозможны два варианта:\nпересадить рыбу в другую подготовленную ёмкость; временно убрать рыбу, полностью слить воду, очистить аквариум и оборудование, затем наполнить его заново. Второй вариант особенно полезен, когда отдельных лечебных аквариумов мало. В данном случае аквариум используется не как постоянная заражённая среда, а как ёмкость, которую можно регулярно освобождать от накопившихся стадий паразита.\n3. Повторять перенос и очистку Чем чаще рыбу отделяют от загрязнённой поверхности и вновь появившихся инфекционных стадий, тем сильнее нарушается передача паразита (Colorni, 1985).\nТеоретически частая смена ёмкости была бы эффективнее редкой. Практически каждая фиксация, ванна и пересадка создают дополнительную нагрузку на рыбу. Поэтому частоту процедур приходится выбирать как компромисс между удалением паразита и переносимостью вмешательства.\nДля многих рыб одна полноценная обработка и пересадка в сутки уже позволяют значительно сократить повторное заражение. При этом решение должно зависеть от:\nтяжести состояния; скорости повторного появления паразитов; устойчивости рыбы к фиксации и пресной воде; возможности поддерживать стабильные параметры в сменных ёмкостях; качества очистки аквариума между пересадками. Пересадка работает не потому, что «лечит» рыбу, а потому, что физически оставляет часть жизненного цикла паразита позади.\n4. Отделить рыбу от дна Приподнятая сетчатая платформа отделяет рыб от дна, на котором могут накапливаться прикреплённые стадии Cryptocaryon irritans. Теронты обладают ограниченной подвижностью: максимальная зарегистрированная скорость движения вверх составляла 1,6 мм/с, а основная их масса в эксперименте находилась в нижнем пятисантиметровом слое воды. Поэтому увеличение расстояния между рыбой и дном может уменьшать вероятность повторного заражения (How et al., 2015).\nДля этого над дном можно установить сетчатую платформу. Ячейка должна быть максимально крупной, но не позволять рыбе пройти сквозь неё. Сама сетка должна иметь как можно меньшую площадь поверхности: тонкие элементы конструкции уменьшают количество мест, к которым могут прикрепиться стадии паразита.\nТакая платформа не уничтожает паразита. Она уменьшает вероятность непосредственного контакта рыбы с участками, на которых он накапливается и продолжает развитие.\nЗадача сетки — не фильтровать воду, а не позволять рыбе лежать непосредственно на заражённой поверхности.\n5. После стабилизации — обработка воды Физическое удаление паразитов и смена ёмкости не отменяют дальнейшего контроля системы. После того как состояние рыбы стабилизировано, можно использовать медь или другой выбранный метод воздействия на свободноживущие стадии паразита.\nОднако последовательность имеет значение:\nсначала уменьшить нагрузку на рыбу; удалить накопившийся материал из окружающей среды; ограничить повторное заражение; затем воздействовать на оставшиеся стадии паразита в воде. Почему провокация выхода мочевиной вызывает сомнения Иногда для стимуляции массового выхода инфекционных стадий Cryptocaryon irritans в воду предлагают вносить мочевину, а затем воздействовать на вышедших теронтов препаратом. Такая схема предполагает, что большая часть паразитов окажется в воде одновременно и будет уничтожена раньше, чем успеет найти хозяина.\nМочевина исследовалась как аттрактант для уже вышедших теронтов, который потенциально может использоваться совместно с ловушкой, а не как доказанное средство синхронного выхода теронтов из томонтов (Skilton et al., 2020).\nНо препарат в концентрации, безопасной для рыбы, не обязательно действует мгновенно. Если внесение мочевины действительно увеличивает количество инфекционных стадий в воде, часть из них может успеть достигнуть рыбы и усилить заражение.\nПоэтому подобная провокация имеет смысл только тогда, когда доказано, что:\nиспользуемое воздействие действительно синхронно вызывает выход стадий; препарат уничтожает их достаточно быстро; концентрация поддерживается точно; рыба физически защищена от контакта с вышедшими теронтами. Если же рыбу можно пересадить, а аквариум — слить и очистить, искусственное увеличение количества паразитов в воде становится труднообъяснимым дополнительным риском.\nПроще удалить рыбу из зоны выхода паразита, чем сначала увеличить число инфекционных стадий, а затем пытаться уничтожить их рядом с хозяином.\nГлавная задача — разорвать повторное заражение Смысл всей схемы заключается не в одном отдельном воздействии, а в последовательном разобщении рыбы и паразита. Сначала с поверхности тела максимально удаляют уже находящихся там паразитов, затем рыбу переносят в чистую среду, очищают ёмкость от осевших стадий и физически отделяют животное от дна, где продолжается развитие паразита.\nЗадача состоит в том, чтобы сделать повторное заражение как можно менее вероятным, а условия существования паразита — как можно менее благоприятными.\nЧем меньше паразитов остаётся на рыбе, чем меньше жизнеспособных стадий сохраняется в окружающей среде и чем реже они снова достигают хозяина, тем больше времени получает животное на восстановление. Последующая обработка воды уже действует не на фоне непрерывно нарастающей инвазии, а в системе, где жизненный цикл паразита максимально нарушен.\nЛитература Burgess P. J., Matthews R. A. 1994. Cryptocaryon irritans (Ciliophora): photoperiod and transmission in marine fish. Journal of the Marine Biological Association of the United Kingdom, 74(3): 535–542. https://doi.org/10.1017/S0025315400047652\nCervera L., González-Fernández C., Arizcun M., Cuesta A., Chaves-Pozo E. 2022. Severe natural outbreak of Cryptocaryon irritans in gilthead seabream produces leukocyte mobilization and innate immunity at the gill tissue. International Journal of Molecular Sciences, 23(2): 937. https://doi.org/10.3390/ijms23020937\nChi H., Goldstein M., Pichardo A., Wei Z.-H., Chang W.-J., Gong H. 2020. Infectivity and genes differentially expressed between young and aging theront cells of the marine fish parasite Cryptocaryon irritans. PLOS ONE, 15(8): e0238167. https://doi.org/10.1371/journal.pone.0238167\nColorni A. 1985. Aspects of the biology of Cryptocaryon irritans, and hyposalinity as a control measure in cultured gilthead sea bream Sparus aurata. Diseases of Aquatic Organisms, 1: 19–22. https://doi.org/10.3354/dao001019\nColorni A., Diamant A. 1993. Ultrastructural features of Cryptocaryon irritans, a ciliate parasite of marine fish. European Journal of Protistology, 29(4): 425–434. https://doi.org/10.1016/S0932-4739(11)80405-0\nHow K. H., Zenke K., Yoshinaga T. 2015. Dynamics and distribution properties of theronts of the parasitic ciliate Cryptocaryon irritans. Aquaculture, 438: 170–175. https://doi.org/10.1016/j.aquaculture.2014.12.013\nKaige N., Miyazaki T. 1985. A histopathological study of white spot disease in Japanese flounder. Fish Pathology, 20(1): 61–64. https://doi.org/10.3147/jsfp.20.61\nLi Y., Jiang B., Mo Z., Li A., Dan X. 2022. Cryptocaryon irritans (Brown, 1951) is a serious threat to aquaculture of marine fish. Reviews in Aquaculture, 14(1): 218–236. https://doi.org/10.1111/raq.12594\nMa R., Ni B., Fan X., Warren A., Yin F., Gu F. 2016. Ultrastructure observation on the cells at different life history stages of Cryptocaryon irritans (Ciliophora: Prostomatea), a parasitic ciliate of marine fishes. Parasitology, 143(11): 1479–1489. https://doi.org/10.1017/S0031182016001074\nSkilton D. C., Saunders R. J., Hutson K. S. 2020. Parasite attractants: identifying trap baits for parasite management in aquaculture. Aquaculture, 516: 734557. https://doi.org/10.1016/j.aquaculture.2019.734557\nYoshinaga T., Dickerson H. W. 1994. Laboratory propagation of Cryptocaryon irritans on a saltwater-adapted Poecilia hybrid, the black molly. Journal of Aquatic Animal Health, 6(3): 197–201. https://doi.org/10.1577/1548-8667%281994%29006%3C0197%3ALPOCIO%3E2.3.CO%3B2\nZec S., Hadfield C. A., Hungerford L. 2021. Retrospective review of copper sulfate immersion treatment in marine teleosts during quarantine at the National Aquarium of Baltimore from 2004 to 2016. Journal of Zoo and Wildlife Medicine, 52(1): 97–102. https://doi.org/10.1638/2020-0114\n","permalink":"https://fossamethod.ru/ru/posts/cryptocaryon-control/","summary":"При тяжёлом криптокарионозе сначала нужно сохранить рыбу живой и уменьшить количество паразитов на её теле, а уже затем воздействовать на жизненный цикл Cryptocaryon в системе.","title":"Криптокарионоз: убиваем паразита или лечим воду?"},{"content":"Здесь собраны научные статьи, материалы конференций и дополнительные материалы, связанные с диагностикой заболеваний рыб, патологией гидробионтов и анализом аквариумных систем.\nДля каждой работы приведено краткое описание и ссылки на доступные версии полного текста, дополнительные данные, фотографии или видеоматериалы.\nНаучные статьи 2026 Клинические проявления и варианты течения криптокарионоза (Cryptocaryon irritans) у морских рыб в условиях аквариумного содержания Степаньков А. П. Клинические проявления и варианты течения криптокарионоза (Cryptocaryon irritans) у морских рыб в условиях аквариумного содержания // Биота и среда природных территорий. 2026. Т. 14, № 2. С. 82–90. DOI: 10.25221/2782-1978_2026_2_8.\nВ работе рассмотрены два различающихся варианта течения криптокарионоза: форма с видимыми изменениями на поверхности тела и жаберная форма, при которой внешние признаки могут отсутствовать. Показано, почему отсутствие белых точек не исключает тяжёлого поражения жабр.\nМатериалы на Fossa Method\rCryptocaryon irritans. Паразит, а не просто белые точки\rНаучно обоснованный разбор биологии Cryptocaryon irritans: жизненный цикл, терминология tomont, theront, trophont, миф о «вездесущем …\rЧитать: на сайте журнала · Видео и дополнительные материалы · DOI\nРоль размерно-весовых зависимостей в мониторинге и оптимизации содержания рыб (опыт Приморского океанариума) Степаньков А. П. Роль размерно-весовых зависимостей в мониторинге и оптимизации содержания рыб (опыт Приморского океанариума). // Биота и среда природных территорий. 2026. Т. 14, № 2. С. 66–75. DOI: 10.25221/2782-1978_2026_2_6.\nРабота посвящена применению размерно-весовых отношений для оценки состояния рыб в условиях океанариума. Рассматриваются ограничения небольших выборок, различия между видами и возможности использования накопленных измерений для практического мониторинга.\nЧитать: на сайте журнала · DOI\nМатериалы конференций 2026 Показания и ограничения к применению лекарственных препаратов в аквариумных системах. А. П. Степаньков. Показания и ограничения к применению лекарственных препаратов в аквариумных системах. Международная научно-практическая конференция \u0026ldquo;Океан в городе\u0026rdquo;, Центр океанографии и морской биологии «Москвариум», Россия, 28 февраля - 1 марта 2026.\nВ работе рассматриваются методологические основы оценки целесообразности медикаментозной терапии в аквариумных системах с позиций экосистемного подхода. Показано, что в условиях замкнутых аквариумных систем лекарственные препараты воздействуют не только на организм рыбы, но и на микробиологические, химические и физические параметры среды, что существенно ограничивает предсказуемость фармакокинетики и терапевтического эффекта. Проанализированы ограничения использования гепатопротекторов и пробиотических препаратов в аквариумных условиях, показана их низкая эффективность без устранения этиологических факторов и контролируемого пути введения. Отдельное внимание уделено влиянию вспомогательных компонентов таблетированных форм на органическую нагрузку и микробиологический баланс системы. Делается вывод о необходимости рационального, диагностически обоснованного подхода к медикаментозным вмешательствам с приоритетом коррекции условий содержания и поддержания стабильности экосистемы аквариума.\nИнформация: Презентация\rПоказания и ограничения к применению лекарственных препаратов в аквариумных системах\r· Страница конференции\nЧитать: ИСТИНА\n2025 Прижизненная диагностика рыб в условиях океанариума: мониторинг здоровья и современные методы. А. П. Степаньков. Прижизненная диагностика рыб в условиях океанариума: мониторинг здоровья и современные методы. Международная научно-практическая конференция \u0026ldquo;Океан в городе\u0026rdquo;, 7-8 февраля 2025, Центр океанографии и морской биологии «Москвариум», Россия.\nРассмотрены методы прижизненной диагностики рыб в условиях океанариума, включая кожные соскобы, смывы с жабр и исследование экскрементов. Показаны способы отбора, маркировки и транспортировки проб, а также возможности микроскопии для выявления паразитов, бактерий и грибоподобных организмов. Подчёркнуто значение регулярного мониторинга для раннего обнаружения патологических процессов и оценки состояния рыб без их умерщвления.\nПрезентация\rПрижизненная диагностика рыб в условиях океанариума: мониторинг здоровья и современные методы\r· Страница конференции\nДокументирование микропроцессов как инструмент эмпирического анализа и образовательный ресурс в практике аквариумистики и ихтиопатологии. А. П. Степаньков. Документирование микропроцессов как инструмент эмпирического анализа и образовательный ресурс в практике аквариумистики и ихтиопатологии. In Морская биология в 21 веке: доклады Всероссийской конференции (памяти академика Алексея Викторовича Жирмунского), pages 253–255, ННЦМБ ДВО РАН Владивосток, 2025.\nРассмотрено использование фото- и видеодокументирования микропроцессов в аквариумистике и ихтиопатологии. Показано, что цифровая фиксация микроскопических объектов и процессов позволяет сохранять визуальные данные, сопоставлять наблюдения во времени, выявлять закономерности и использовать материалы для последующего анализа. Особое внимание уделено документированию развития икры рыб, морфологических особенностей микрообъектов и микроскопической картины патологических процессов. Отмечена образовательная ценность таких материалов: они позволяют демонстрировать динамические явления, которые трудно воспроизвести в рамках обычного учебного занятия, и формировать у специалистов навыки наблюдения и интерпретации. Подчёркнуто, что цифровые фото- и видеоматериалы могут служить одновременно эмпирической основой исследования и универсальным образовательным ресурсом.\nЛетающие слоны\rЛетающие слоны\rПочему в науке недостаточно красивой гипотезы. О роли фотографий, видео, препаратов и исходных данных в построении и проверке научных …\rЧто считать доказательством в эпоху искусственного интеллекта?\rКакие ваши доказательства?\rПочему в эпоху искусственного интеллекта уже недостаточно фотографии, видео и убедительного текста. О происхождении данных, проверяемости …\rЧитать: Elibrary · Страница конференции\nИнтеграция биологических и экологических параметров в базе данных: от повседневного учёта к научному анализу А. П. Степаньков. ИНТЕГРАЦИЯ БИОЛОГИЧЕСКИХ И ЭКОЛОГИЧЕСКИХ ПАРАМЕТРОВ В БАЗЕ ДАННЫХ: ОТ ПОВСЕДНЕВНОГО УЧЁТА К НАУЧНОМУ АНАЛИЗУ. In Труды XIV Международной научно-практической конференции Морские исследования и образование (MARESEDU-2025) Том III (IV), volume 3 of Труды Международной научно-практической конференции Морские исследования и образование (MARESEDU), pages 279–287, ООО ПолиПРЕСС, 2025.\nПредставлен опыт разработки универсальной базы данных для комплексного учёта гидробионтов в условиях океанариума. Система объединяет сведения о поставках и перемещениях животных, кормлении, морфометрических показателях, падеже и параметрах среды. Особое внимание уделено использованию стандартной длины рыб, построению собственных размерно-весовых зависимостей и контролю фактического кормления. Связь биологических и экологических данных позволяет оценивать динамику численности и роста, выявлять критические периоды, корректировать рационы и условия содержания, а также проводить ретроспективный анализ. Показано, что интеграция разнородных наблюдений в единую систему превращает рутинный учёт в инструмент мониторинга, анализа и прогнозирования состояния животных в искусственных экосистемах.\nЧитать: ИСТИНА · Страница конференции · Презентация\rИнтеграция биологических и экологических параметров в базе данных.\r2024 Клинические случаи нетипичной формы криптокарионоза. А. П. Степаньков. Клинические случаи нетипичной формы криптокарионоза. V Международная конференция \u0026ldquo;Публичный аквариум в современном мире\u0026rdquo;, Санкт-Петербург, 28-30 мая 2024 г.\nРассмотрены случаи нетипичного течения криптокарионоза у морских рыб, при котором видимые белые точки отсутствуют, а основное поражение развивается в жабрах. На примере анализа публикаций показано, как повторение упрощённых описаний клинических признаков приводит к тому, что различия между формами заболевания остаются незамеченными. Подчёркнута необходимость учитывать жаберную форму и не ограничивать диагностику только внешним осмотром.\nИнформация: Презентация\rКлинические случаи нетипичной формы криптокарионоза\r· Страница конференции · Материалы на Fossa Method\rCryptocaryon irritans. Паразит, а не просто белые точки\rНаучно обоснованный разбор биологии Cryptocaryon irritans: жизненный цикл, терминология tomont, theront, trophont, миф о «вездесущем …\r2023 Интегрируемые решения для сбора, обработки и вывода данных, используемые в приморском океанариуме. Степаньков А. П. Интегрируемые решения для сбора, обработки и вывода данных, используемые в приморском океанариуме. In Межвед. сб. науч. и науч.-метод. тр. Проблемы аквакультуры (аквариология и аквариумные экспозиции), volume 7, pages 34–39, ООО Аква Лого Инжиниринг, ГАУ Московский зоопарк, ЕАРАЗА, СОЗАР Москва, 2024.\nРассмотрен подход к организации единой системы сбора, хранения и анализа данных в условиях океанариума. Интеграция MariaDB, Microsoft Access, табличных процессоров и языка R обеспечивает централизованное хранение информации, разграничение доступа, автоматизацию отчётности и статистическую обработку данных. Показано, что такая архитектура позволяет сократить время работы с информацией, повысить гибкость системы и упростить взаимодействие между подразделениями.\nЧитать: Elibrary · Страница конференции\nСм. также Ихтиофтириоз\rИхтиофтириоз без мифов\rРазбор биологии Ichthyophthirius multifiliis жизненный цикл, терминология цисты, миф о вездесущем паразите и реальные механизмы …\rГексамиты\rГексамитиды\rПочему гексамитиды не являются нормальной микрофлорой кишечника рыб, откуда берётся миф о «внутренних паразитах», и как на самом деле …\rЧто делать с рыбой после приезда\rЧто делать с рыбой после приезда\rРыбка приехала — достаём микроскоп, делаем мазки, изучаем бактерии и решаем, что делать дальше. Без паники и с умом.\r","permalink":"https://fossamethod.ru/ru/publications/","summary":"Статьи, тезисы конференций и дополнительные материалы с краткими описаниями и ссылками на полные тексты.","title":"Публикации"},{"content":"\nВведение Газопузырьковая болезнь (ГПЗ) — это состояние, при котором в крови и тканях рыб формируются свободные газовые пузырьки. Оно приводит к нарушению микроциркуляции, повреждению жабр, деструкции органов и, в ряде случаев, гибели.\nРаспространённое объяснение — «пузырьки воздуха попали в жабры и закупорили их» — неверно. Оно подменяет механизм и мешает правильно интерпретировать как клиническую картину, так и результаты вскрытия.\nРазбор механизма заболевания приведён здесь\rГазопузырьковая болезнь. Не в пузырьках дело...\rГазопузырьковая болезнь у рыб — не результат попадания пузырьков в жабры, а следствие перенасыщения воды растворёнными газами. В статье …\r.\nПочему трудно поставить диагноз Газопузырьковая болезнь не всегда оставляет очевидные признаки: пузырьки могут отсутствовать, исчезать после гибели, быть единичными и не иметь диагностической ценности, что отмечается и в обобщающих работах по газовой травме у рыб (Pleizier et al., 2020).\nОстрые случаи с выраженными пузырями — скорее исключение, чем правило.\nВ большинстве случаев наблюдается вялотекущий процесс, который внешне остаётся незаметным.\nОткуда берётся проблема В системах с насосами формируется давление выше атмосферного. Это увеличивает растворимость газов в воде. При наличии подсоса воздуха, кавитации или пузырьков на входе в насос формируется газо-водяная смесь. В результате возникает перенасыщение воды газами, что в условиях замкнутых систем содержания рыб рассматривается как один из ключевых факторов развития газопузырьковой болезни (Hong et al., 2024).\nВ острых случаях это приводит к быстрой гибели с выраженными признаками:\nгаз в глазах пузырьки в плавниках скопления газа в полостях Однако это не типичный сценарий.\nЧто действительно происходит При хроническом перенасыщении газами развивается нарушение газообмена. Кислород может поступать в ткани, но инертные газы (в первую очередь азот) выводятся недостаточно эффективно. Происходит их накопление в растворённой форме (Pleizier et al., 2020).\nЭто приводит к:\nнарушению микроциркуляции застою крови развитию ишемии и последующей гипоксии тканей Несмотря на наличие крови в органах, она не выполняет свою функцию.\nНаличие крови в органе не означает нормального кровообращения.\nК чему это приводит При длительном воздействии формируется последовательный каскад нарушений:\nнарушение газообмена микроциркуляторные расстройства ишемия гипоксия деструкция органов Наиболее чувствительны к этим изменениям:\nжабры почки головной мозг Именно их поражение чаще всего выявляется при вскрытии.\nИшемия — это состояние, при котором ткань испытывает недостаток кислорода вследствие нарушения кровоснабжения или микроциркуляции.\nВажно Наличие газа в тканях при вскрытии само по себе не является доказательством ГПЗ.\nПосмертные газовые пузыри могут формироваться при:\nнагревании трупа автолизе изменении давления Особенно это заметно, если рыба содержалась в холодной воде, а вскрытие проводится при более высокой температуре: при нагревании растворимость газов снижается, и они выходят из раствора, формируя пузырьки.\nТаким образом, наличие газа при вскрытии отражает не только процессы, происходившие при жизни, но и изменения, возникшие после гибели.\nКонтекст важнее отдельных находок.\nПоследствия. Макро- и микрокартина Сердце рыб перекачивает венозную кровь. Кровообращение представлено одним кругом: кровь проходит через жабры, где происходит газообмен, затем распределяется по тканям и возвращается в сердце.\nСердце направляет поток крови в сторону головы. Из-за близкого расположения сосудов к поверхности в области рыла нарушения кровообращения проявляются визуально.\nПри застое крови наблюдаются:\nпокраснение переполнение сосудов дилатация гиперемия Гиперемия в области рта и рыла.\rТакой симптом не является специфичным и сам по себе не указывает на инфекционный процесс.\rГаз в сосудах жаберных лепестков.\rДалее кровь поступает в жабры. Жабры являются одним из наиболее чувствительных органов к газовой эмболии, что подтверждается экспериментальными и морфологическими исследованиями (Pleizier \u0026 Brauner, 2024). Жабры — высокочувствительный орган. При нарушении микроциркуляции возникает застой крови, снижается эффективность газообмена, развивается ишемия тканей. В тяжёлых случаях это приводит к некрозу.\rНекроз — необратимая гибель клеток и тканей при жизни организма. Дегенерация — патологические изменения структуры и функции клеток и тканей, которые могут быть как обратимыми, так и необратимыми. Аутолиз — посмертное разрушение клеток и тканей под действием собственных ферментов.\nЭти понятия нередко смешивают. Например, разрушение жаберных лепестков у погибшей рыбы могут описывать как «посмертный некроз». Однако некроз является прижизненным процессом, тогда как разрушение тканей после смерти может быть следствием аутолиза.\nСамо по себе обнаружение разрушенных жаберных лепестков не позволяет установить, когда возникли изменения — до гибели рыбы или после неё.\nСосуды головного мозга расширены, отмечаются кровоизлияния. Далее кровь поступает в головной мозг. Нарушение микроциркуляции приводит к венозному застою, повышению давления и повреждению сосудов. Такие изменения отражают развитие ишемии нервной ткани. Почки у рыб подразделяются на головную и туловищную.\nТуловищная почка располагается вдоль позвоночника под плавательным пузырём и содержит почечные канальцы — основные функциональные структуры. Через неё проходит значительный объём крови, поэтому нарушения микроциркуляции быстро приводят к выраженным изменениям.\nХарактерные признаки:\nгиперемия деструкция канальцев некроз ткани\nНормальная структура туловищной почки рыбы. На изображении представлен компрессионный препарат туловищной (задней) почки рыбы. В отличие от головной почки, которая выполняет преимущественно кроветворную и иммунную функции и представлена рыхлой гемопоэтической тканью, туловищная почка является основным органом выделительной системы. Её структура характеризуется выраженным развитием канальцевого аппарата: канальцы хорошо различимы, имеют чёткие контуры и свободные просветы. Именно поэтому любые изменения — гиперемия, деструкция или утрата структуры — в первую очередь оцениваются относительно состояния этих канальцев. Именно нарушение этой структуры лежит в основе наблюдаемых патологических изменений.\nТаким образом, представленное изображение можно рассматривать как морфологическую норму, служащую отправной точкой для интерпретации патологических изменений. Выраженная гиперемия, признаки кровоизлияний. Канальцы ещё частично сохранены. Деструкция ткани: канальцы плохо дифференцируются. Тяжёлое поражение: паренхима гомогенна, структура утрачена. При хроническом течении ГПЗ рыбы могут доживать до подобных стадий. Гибель при пересадке или стрессе в таких случаях является следствием уже развившихся изменений, а не их причиной.\nИзменения в глазу.\rГазовые пузыри у рыбы при газопузырьковой болезни.\rГоловная почка выполняет преимущественно кроветворную функцию. Канальцы в ней отсутствуют, но при нарушениях микроциркуляции отмечается гиперемия.\rРядом располагаются глаза. В зависимости от вида, в них может накапливаться газ.\rНаблюдаются гиперемия, кровоизлияния, скопления газа.\rГаз в предсердии при газопузырьковой болезни у рыб. Газ в предсердии при газопузырьковой болезни у рыб.. В сердце также могут обнаруживаться газовые пузыри, однако чаще это наблюдается при выраженном перенасыщении.\nГаз в крови при газопузырьковой болезни у рыб. Пенистая кровь у рыб при газопузырьковой болезни. Если в сердце визуализируются пузырьки, это может указывать на высокое содержание растворённых газов в крови. При переливании такой крови пипеткой газ выделяется активно и хорошо заметен. В норме кровь не склонна к образованию устойчивой пены, и выделение газа выражено значительно слабее.\nВыводы Газопузырьковая болезнь не сводится к наличию пузырьков в тканях. Это прежде всего нарушение микроциркуляции и газообмена, которое может протекать без выраженных макроскопических признаков. Отсутствие пузырьков при вскрытии не исключает диагноз. И наоборот, их наличие не подтверждает его без анализа условий содержания и клинической картины. Основные изменения развиваются постепенно и связаны с нарушением кровоснабжения тканей. В результате формируется ишемия, которая приводит к гипоксии и последующей деструкции органов. Наиболее чувствительными оказываются жабры, почки и головной мозг.\nНаличие крови в органе не означает, что он функционирует нормально. Переполнение сосудов может отражать застой и нарушение оттока, а не адекватное кровообращение. Многие находки при вскрытии требуют осторожной интерпретации. Газ в тканях может образовываться после гибели организма и не всегда связан с прижизненными процессами. Диагноз не может основываться на одном признаке. Он формируется только при сопоставлении морфологических изменений, условий содержания и истории развития симптомов.\nПонимание механизма важнее запоминания отдельных признаков. Только это позволяет отличать причину от следствия и избегать типичных диагностических ошибок.\nГазопузырьковая болезнь. Часть I.\rГазопузырьковая болезнь. Не в пузырьках дело...\rГазопузырьковая болезнь у рыб — не результат попадания пузырьков в жабры, а следствие перенасыщения воды растворёнными газами. В статье …\rЛитература Hong, W.H., Choi, J.Y., Cho, H.S., Im, J., Park, S.C., Seok, S.H., Kim, S.W., 2024. Gas bubble disease in captive Golden Trevally: Pathological insights and needs for life support system and water quality management. J Aquat Anim Health 36, 348–354. https://doi.org/10.1002/aah.10237 Pleizier, N., Algera, D., Cooke, S., Brauner, C., 2020. A meta‐analysis of gas bubble trauma in fish. Fish and Fisheries 21. https://doi.org/10.1111/faf.12496 Pleizier, N.K., Brauner, C.J., 2024. Causes and consequences of gas bubble trauma on fish gill function. J Comp Physiol B 194, 739–747. https://doi.org/10.1007/s00360-024-01538-4 Вопросы и ответы Газ в тканях — это доказательство болезни? Нет. Он может образовываться после смерти.\nПочему органы выглядят «переполненными кровью»? Это может быть застой, а не нормальное кровообращение.\nПочему пузырьков может не быть? Потому что процесс часто протекает скрыто.\nКакие органы страдают сильнее всего? Жабры, почки и головной мозг.\nМожно ли поставить диагноз по одному признаку? Нет. Важен комплекс изменений и условия содержания.\n","permalink":"https://fossamethod.ru/ru/posts/bubble_diagnoz/","summary":"Разбор органов рыбы при вскрытии через сравнение: как выглядит норма, что может быть вариантом нормы и какие изменения уже говорят о патологии.","title":"Газопузырьковая болезнь. Часть II. Последствия."},{"content":"\nКокцидии у рыб встречаются регулярно, однако в большинстве случаев остаются незамеченными. Их обнаружение требует целенаправленного микроскопического исследования, так как макроскопические признаки либо отсутствуют, либо неспецифичны.\nGoussia sp. Goussia sp. Goussia sp. На представленных микрофотографиях выявлены кокцидии, паразитирующие в стенке кишечника чебачка амурского.\nОоцисты овальной формы, размером около 10–15 мкм, с чётко выраженной оболочкой. Внутри определяются четыре спороцисты. Их содержимое представлено вытянутыми споразоитами, хорошо различимыми в нативных препаратах.\rПод микроскопом хорошо различимы ооцисты овальной формы с плотной оболочкой. Внутри определяются спороцисты, занимающие большую часть объёма. Обращает на себя внимание чёткая организация внутреннего содержимого — структуры не распадаются и сохраняют форму, что отличает их от клеточного детрита.\rНа отдельных препаратах видно три спороцисты внутри одной ооцисты. Каждая имеет собственное содержимое, в котором различимы вытянутые споразоиты. Важно обращать внимание не только на форму ооцисты, но и на внутреннюю архитектуру — именно она позволяет отличить кокцидий от других включений.\nGoussia sp. Goussia sp.\nОкрашенные препараты подчёркивают оболочку ооцисты, однако внутренние структуры могут становиться менее контрастными. В таких случаях важно ориентироваться на общую форму, размер и повторяемость объектов. Однородное окрашивание не исключает наличие паразита.\nПри наблюдении групп ооцист хорошо видна повторяемость формы и размеров — это один из ключевых признаков паразитарной природы. Спороцисты имеют вытянутую форму, а их содержимое ориентировано вдоль оси, что характерно для Goussia.\nОоцисты с хорошо выраженными спороцистами позволяют увидеть вытянутые споразоиты. Именно такие «червеобразные» структуры являются одним из наиболее надёжных диагностических признаков. Их важно не путать с артефактами или продуктами распада тканей.\nКлючевым диагностическим признаком является организация внутреннего содержимого. В отличие от Eimeria, где спороцисты имеют выраженную собственную оболочку и выглядят более компактными, у Goussia споразоиты визуализируются как оформленные продолговатые структуры без чётко отделённой стенки спороцисты.\nПаразиты локализуются в эпителии кишечника и проходят внутриклеточные стадии развития. Это сопровождается повреждением клеток, десквамацией и накоплением слизи в просвете кишечника. При умеренной интенсивности инвазии кокцидии могут не вызывать выраженной клинической картины. Однако при увеличении нагрузки или ослаблении организма наблюдаются нарушения пищеварения, истощение и гибель рыб.\nВажно учитывать, что кокцидии не вызывают образования гранулём. Обнаружение гранулематозного воспаления требует поиска других причин и не должно интерпретироваться как проявление кокцидиоза.\rИнтерпретация Наличие кокцидий в кишечнике не всегда означает заболевание. Важна оценка интенсивности инвазии и состояния тканей.\nЕдиничные ооцисты могут рассматриваться как фоновая находка. Массовое присутствие внутриклеточных стадий, сопровождающееся разрушением эпителия, указывает на патологический процесс.\nОбнаружение спорулирующих форм в ткани свидетельствует об активном цикле паразита, а не о случайном попадании ооцист из внешней среды.\nДифференциальная диагностика Основная сложность возникает при разграничении Goussia и Eimeria.\nEimeria характеризуется наличием спороцист с чётко выраженной оболочкой. Их внутреннее содержимое чаще выглядит как компактная зернистая масса.\nДля Goussia характерно отсутствие выраженной оболочки спороцисты и наличие хорошо различимых вытянутых споразоитов, формирующих «червеобразные» структуры внутри ооцисты.\nCryptosporidium отличается значительно меньшими размерами и локализацией на поверхности эпителия, без формирования спороцист.\nПрактическое значение Кокцидии являются частью скрытого микромира аквариумных систем. Они могут длительное время присутствовать в популяции, не вызывая явных симптомов, но при изменении условий быстро переходят в клинически значимую форму.\nБез микроскопии такие процессы остаются незамеченными и часто интерпретируются как «необъяснимые» нарушения.\nРегулярный контроль позволяет выявлять подобные инвазии на ранних стадиях и корректно оценивать их значение для состояния рыб.\n","permalink":"https://fossamethod.ru/ru/posts/goussia/","summary":"Ооцисты с вытянутыми споразоитами — характерный признак Goussia. Разбор микрофотографий и диагностики.","title":"Кокцидии у рыб: Goussia"},{"content":"\nВ препаратах рыб периодически обнаруживаются округлые структуры с выраженной светлой зоной вокруг клетки. Визуально они напоминают дрожжеподобные формы с капсулой и могут ассоциироваться с криптококками. Однако одного морфологического сходства недостаточно для постановки диагноза. На этой странице приведены наблюдения подобных структур и попытка аккуратной интерпретации с учётом контекста. Сравнение с литературными данными В классическом варианте криптококки представлены округлыми клетками с выраженной капсулой, нередко демонстрируют почкование и локализуются в тканях, в том числе внутри макрофагов. Наблюдение Округлые структуры с выраженным halo. В нативных препаратах выявляются округлые элементы с чёткой светлой зоной по периферии. Размеры варьируют, внутреннее содержимое неоднородное, в отдельных структурах просматриваются включения.\nМорфологическое разнообразие структур. Часть объектов выглядит сходно, но при внимательном рассмотрении заметна выраженная вариабельность. Устойчивого почкования, характерного для дрожжевых форм, в большинстве случаев не наблюдается.\nСтруктура с выраженной оболочкой и зернистым внутренним содержимым. На отдельных препаратах выявляются структуры с чёткой оболочкой и выраженным внутренним содержимым.\nВ отличие от типичных дрожжевых форм, центральная часть здесь неоднородна и представлена множественными включениями. Такая картина может соответствовать стадии развития или спорообразованию и требует осторожной интерпретации. Наличие подобного внутреннего строения дополнительно указывает на то, что наблюдаемые объекты не следует автоматически относить к криптококкам только на основании наличия halo.\nКлинический контекст Подобные структуры были выявлены у *Danio rerio*. Поражение носило системный характер с вовлечением паренхиматозных органов. Отмечалось гранулёматозное воспаление. Микобактериоз при этом исключён по результатам микроскопии. В этом контексте морфологические находки нельзя рассматривать как случайные. Они включаются в общую картину процесса, что делает грибную природу вероятной. Интерпретация Сочетание внутритканевой локализации, гранулём и округлых структур с halo действительно сближает наблюдение с криптококкоподобными поражениями. Однако отсутствуют признаки, которые позволили бы уверенно отнести этот случай к криптококкозу. Прежде всего это отсутствие чётко выраженного почкования и морфологическая неоднородность наблюдаемых структур. Кроме того, подобный halo не является строго специфическим признаком и может формироваться при различных состояниях, включая осмотические эффекты и особенности подготовки препарата. Вывод Округлые структуры с выраженной светлой зоной могут напоминать криптококки, особенно при наличии гранулёматозного воспаления и поражения внутренних органов. Тем не менее морфология в данном случае задаёт лишь направление для интерпретации, но не позволяет поставить окончательный диагноз. Такие находки требуют осторожного подхода и оценки в контексте всей картины процесса. ","permalink":"https://fossamethod.ru/ru/posts/crypto/","summary":"Не всё с капсулой — криптококк. Морфология похожа, но вывод требует осторожности.","title":"Cryptococcus-like структуры у рыб"},{"content":"\nИсследованные рыбы при жизни не проявляли признаки какого-либо заболевания. Смерть наступала, преимущественно, в ночное время суток.\nЖабры были анемичными, тела немного худыми. При вскрытии обнаруживались гранулемы в селезенке и/или почках. Паренхиматозные органы были анемичными и увеличены. Макрокартина соответствовала микобактериозу. Окрашивание мазков-отпечатков с селезенки и почек методом Циля-Нельсона кислотоустойчивые бактерии не выявило, гранулемы некротические, что в большинстве случаев свойственно микобактериям. Головная почка Chromis viridis с крупными гранулемами.\rГранулемы в селезенке Chromis viridis. Скопление паразитов в базофильным подковообразным ядром. Окрашивание мазков-отпечатков методами Грамма и Романовского-Гимзе, а также тщательная микроскопия позволили выявить множество мелких грамположительных почкующихся клеток диаметром 1-3 мкм в гистиоцитах почек и селезенок. Клетки крупнее имели подобие базофильного подковообразного “ядра” (рис. 1-6).\nВключения в гистиоците в селезенке Chrysiptera cyanea. Окрашено метиленовым синим по Леффлеру. Черная длинная стрелка - гистиоцит. Серые короткие стрелки - паразиты. Подковообразные ядра гистиоцитах селезенки Chromis viridis. Окраска по методу Романовского-Гимзе Подковообразные ядра гистиоцитах туловищной почки Chrysiptera cyanea. Окраска по методу Романовского-Гимзе Почкующихся клетки в селезенке Acanthurus leucosternon. Окраска по методу Романовского-Гимзе. Включения в гистиоцитах селезенки Acanthurus leucosternon. Окрашено метиленовым синим по Леффлеру Полученные данные могут свидетельствовать о диффузном инвазивном микозе дрожжевыми грибками рода Histoplasma. Формирование эпителиоидно-клеточных гранулем и некротизирующий гранулематоз чаще описан при H. сapsulatum. Во всех случаях мицелий не выявлен. Значительное гранулематозное воспаление паренхиматозных органов может свидетельствовать о хроническом вялотекущем заболевании.\nДанный случай подтверждает существование в аквариумистике заболеваний с нестандартной этиологией и напоминает о важности тщательного поиска возбудителя заболевания. Ранее в литературе заявлялось лишь о экспериментальном заражении пойкилотермных животных с целью выяснить развитие гистоплазмоза в условиях не характерно низких для данного паразита температур (ниже 35С)(\u0026ldquo;Experimental histoplasmosis in cold-blooded animals\u0026rdquo; DOI:10.1007/BF02063081).\n","permalink":"https://fossamethod.ru/ru/posts/histoplasma-like/","summary":"\u003cbr\u003e\r\n\u003cp\u003eИсследованные рыбы при жизни не проявляли признаки какого-либо заболевания. Смерть наступала, преимущественно, в ночное время суток.\u003c/p\u003e\n\u003cbr\u003e\r\nЖабры были анемичными, тела немного худыми. При вскрытии обнаруживались гранулемы в селезенке и/или почках. Паренхиматозные органы были анемичными и увеличены. Макрокартина соответствовала микобактериозу. Окрашивание мазков-отпечатков с селезенки и почек методом Циля-Нельсона кислотоустойчивые бактерии не выявило, гранулемы некротические, что в большинстве случаев свойственно микобактериям. \r\n\u003cdiv style=\"clear: both;\"\u003e\u003c/div\u003e\r\n\u003cbr\u003e\r\n\u003cfigure class=\"float-left zoom-container\" style=\"width: 31%;\"\u003e\n  \u003cimg src=\"https://fossamethod.ru/ru/posts/histoplasma-like/Chromis_viridis.webp\"\n       alt=\"Головная почка Chromis viridis с крупными гранулемами.\"\n       class=\"zoom-image\"\n       loading=\"lazy\"\n       decoding=\"async\"\n       style=\"width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);\"\u003e\u003cfigcaption style=\"font-size: 0.85em; color: #666; margin-top: 0.4em; margin-left: 1em; margin-right: 1em;\"\u003eГоловная почка Chromis viridis с крупными гранулемами.\u003c/figcaption\u003e\u003c/figure\u003e\u003cscript type=\"application/ld+json\"\u003e\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"ImageObject\",\n  \"contentUrl\": \"https:\\/\\/fossamethod.ru\\/ru\\/posts\\/histoplasma-like\\/Chromis_viridis.webp\",\n  \"name\": \"Головная почка Chromis viridis с крупными гранулемами.\",\n  \"description\": \"Головная почка Chromis viridis с крупными гранулемами.\",\n  \"creator\": {\n    \"@type\": \"Person\",\n    \"name\": \"Artem Stepankov\"\n  },\n  \"creditText\": \"Artem Stepankov, Fossa Method\",\n  \"copyrightNotice\": \"© Fossa Method\",\n  \"license\": \"http:\\/\\/localhost:52184\\/ru\\/license\\/\",\n  \"acquireLicensePage\": \"http:\\/\\/localhost:52184\\/ru\\/contact\\/\"\n}\n\u003c/script\u003e\r\n\u003cfigure class=\"float-left zoom-container\" style=\"width: 31%;\"\u003e\n  \u003cimg src=\"https://fossamethod.ru/ru/posts/histoplasma-like/Histo_Spleen.webp\"\n       alt=\"Гранулемы в селезенке Chromis viridis.\"\n       class=\"zoom-image\"\n       loading=\"lazy\"\n       decoding=\"async\"\n       style=\"width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);\"\u003e\u003cfigcaption style=\"font-size: 0.85em; color: #666; margin-top: 0.4em; margin-left: 1em; margin-right: 1em;\"\u003eГранулемы в селезенке Chromis viridis.\u003c/figcaption\u003e\u003c/figure\u003e\u003cscript type=\"application/ld+json\"\u003e\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"ImageObject\",\n  \"contentUrl\": \"https:\\/\\/fossamethod.ru\\/ru\\/posts\\/histoplasma-like\\/Histo_Spleen.webp\",\n  \"name\": \"Гранулемы в селезенке Chromis viridis.\",\n  \"description\": \"Гранулемы в селезенке Chromis viridis.\",\n  \"creator\": {\n    \"@type\": \"Person\",\n    \"name\": \"Artem Stepankov\"\n  },\n  \"creditText\": \"Artem Stepankov, Fossa Method\",\n  \"copyrightNotice\": \"© Fossa Method\",\n  \"license\": \"http:\\/\\/localhost:52184\\/ru\\/license\\/\",\n  \"acquireLicensePage\": \"http:\\/\\/localhost:52184\\/ru\\/contact\\/\"\n}\n\u003c/script\u003e\n\u003cfigure class=\"float-left zoom-container\" style=\"width: 31%;\"\u003e\n  \u003cimg src=\"https://fossamethod.ru/ru/posts/histoplasma-like/histo_6.webp\"\n       alt=\"Скопление паразитов в базофильным подковообразным ядром.\"\n       class=\"zoom-image\"\n       loading=\"lazy\"\n       decoding=\"async\"\n       style=\"width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);\"\u003e\u003cfigcaption style=\"font-size: 0.85em; color: #666; margin-top: 0.4em; margin-left: 1em; margin-right: 1em;\"\u003eСкопление паразитов в базофильным подковообразным ядром.\u003c/figcaption\u003e\u003c/figure\u003e\u003cscript type=\"application/ld+json\"\u003e\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"ImageObject\",\n  \"contentUrl\": \"https:\\/\\/fossamethod.ru\\/ru\\/posts\\/histoplasma-like\\/histo_6.webp\",\n  \"name\": \"Скопление паразитов в базофильным подковообразным ядром.\",\n  \"description\": \"Скопление паразитов в базофильным подковообразным ядром.\",\n  \"creator\": {\n    \"@type\": \"Person\",\n    \"name\": \"Artem Stepankov\"\n  },\n  \"creditText\": \"Artem Stepankov, Fossa Method\",\n  \"copyrightNotice\": \"© Fossa Method\",\n  \"license\": \"http:\\/\\/localhost:52184\\/ru\\/license\\/\",\n  \"acquireLicensePage\": \"http:\\/\\/localhost:52184\\/ru\\/contact\\/\"\n}\n\u003c/script\u003e\n\u003cdiv style=\"clear: both;\"\u003e\u003c/div\u003e\r\n\u003chr\u003e\n\u003cp\u003eОкрашивание мазков-отпечатков методами Грамма и Романовского-Гимзе, а также тщательная микроскопия позволили выявить множество мелких грамположительных почкующихся клеток диаметром 1-3 мкм в гистиоцитах почек и селезенок. Клетки крупнее имели подобие базофильного подковообразного “ядра” (рис. 1-6).\u003c/p\u003e","title":"Гранулематозные поражения у рыб: histoplasma-like случай"},{"content":"\nГрибные элементы в препаратах рыб встречаются регулярно.\nОднако их обнаружение само по себе не позволяет сделать однозначный вывод о природе процесса. В одних случаях это поверхностная колонизация повреждённых тканей, в других — инвазивное поражение с распространением в тканях и полостях.\nНа этой странице представлены наблюдения грибных структур у рыб и подход к их интерпретации.\nСапролегния и поверхностная колонизация Наиболее известные «грибковые» поражения у рыб связаны с сапролегнией. В аквариумистике это выглядит как характерный «пушок» на теле. В подавляющем большинстве случаев сапролегния является не причиной, а следствием повреждений тканей, некроза, стресса (транспортировка, агрессия, параметры среды).\nИммунная система рыб в норме эффективно сдерживает развитие этих организмов, несмотря на то, что их споры постоянно присутствуют в воде. При ослаблении защиты гриб начинает активно развиваться и формирует поверхностные мицелиальные массы. Именно поэтому молодь поражается чаще: менее развитая иммунная система, меньшие размеры, ограниченное время на компенсацию повреждений.\nВажно отметить, что сапролегния — это не «настоящий гриб», а представитель оомицетов.\nТем не менее морфологически она формирует типичные мицелиальные структуры.\nМикробные сообщества Поверхностные мицелиальные разрастания редко существуют изолированно. Гифы формируют структуру, в которой локализуются бактерии, инфузории, нематоды. Фактически это сложная микробная система, а не изолированный грибной процесс.\nПаразитические формы Существуют случаи, когда грибные элементы ведут себя иначе.\nВ отличие от сапролегнии гифы не образуют выраженных «пучков», а стелются по поверхности тканей, переплетаются, формируют плотные слизистые структуры. Такие процессы могут сопровождаться поражением внутренних органов.\nНаблюдение Ниже приведён пример поражения у молоди лососевых.\nТипичная картина:\nжабры анемичные, светло-розовые, внутренние органы анемичные, покрыты прозрачной слизью, желудок и кишечник заполнены слизью, в содержимом и на органах обнаруживаются споры грибов. Часто такие состояния сопровождаются вздутием кишечника.\nВажно:\nбактериальное газообразование чаще развивается посмертно, в то время как подобные изменения при грибном процессе могут формироваться прижизненно.\nСлизь в полости тела. В полости тела органы покрыты слизью.\nСпоры в слизи с внутренних органов. Споры хорошо выявляются в слизистом содержимом внутренних органов.\nВ мышцах кровоподтеки. В брюшке \u0026ldquo;на просвет\u0026rdquo; обнаруживаются кровоподтеки.\nМицелиальные структуры в нативном препарате. В соскобах обнаруживаются гифы и структуры, связанные со спорообразованием.\nКартина становится целостной:\nгифы локализуются в тканях и полостях, споры присутствуют в слизи, изменения имеют системный характер. Это позволяет связать морфологические находки в единый процесс.\nСпоры. Окраска синькой Леффлера (нативно). Споры. Май–Грюнвальд. Споры. Май–Грюнвальд. При окраске наблюдается уменьшение размеров спор, что может затруднять интерпретацию.\nПоэтому для первичного выявления предпочтительно использовать нативные препараты и применять водные красители (например, Леффлер).\nГрибные структуры у рыб могут отражать как вторичную колонизацию, так и самостоятельный патологический процесс. Их оценка должна основываться не на факте обнаружения, а на морфологии, локализации и контексте. ","permalink":"https://fossamethod.ru/ru/posts/fungi/","summary":"Гифы у рыб — это не всегда сапролегниоз. Важно различать колонизацию и инвазивный процесс.","title":"Грибные структуры у рыб: колонизация или инвазивный процесс"},{"content":"\nГранулёматозные изменения у рыб не следует автоматически отождествлять с микобактериозом. Одинаковая макрокартина может скрывать разную этиологию, а решающее значение часто имеет именно микроскопия.\rНа этой странице собраны отдельные наблюдения и морфологические примеры.\nКаждая карточка ведёт на самостоятельную страницу с полным разбором.\nHistoplasma-like структуры\rМелкие внутриклеточные дрожжеподобные клетки 1–3 мкм в гистиоцитах селезёнки и почек. Halo, почкование и подковообразное базофильное содержимое.\nОткрыть разбор\rCryptosporidium-like структуры\rМелкие однотипные округлые образования с выраженным halo. Морфологически напоминают криптоспоридий, но требуют осторожной интерпретации.\nОткрыть разбор\rГуссия (Goussia)\rКокцидии с овальными ооцистами и вытянутыми споразоитами внутри спороцист. Характерный пример паразитов кишечника рыб.\nОткрыть разбор\rВнутриклеточные грибные формы\rКрупные клетки с множественными включениями и тканевые формы, потенциально связанные с грибной этиологией.\nОткрыть разбор\rВажно\nВ патологической анатомии и микробиологии гранулёма является неспецифической реакцией.\nОна показывает наличие хронического воспалительного процесса, но сама по себе не указывает на конкретного возбудителя.\nВопросы и ответы Гранулёма — это всегда микобактериоз? Нет. Гранулёма — неспецифическая реакция и может иметь разную природу.\nМожно ли поставить диагноз по макрокартине? Нет. Внешне одинаковые изменения могут иметь разную этиологию.\nЗачем нужна микроскопия? Она позволяет увидеть внутриклеточные структуры и отличить разные процессы.\nВсе ли «похожие на паразитов» структуры — паразиты? Нет. Морфология может вводить в заблуждение, требуется осторожная интерпретация.\nПочему важно не спешить с выводами? Потому что одинаковая картина может быть результатом разных процессов.\n","permalink":"https://fossamethod.ru/ru/posts/intracellular/","summary":"Внутриклеточные формы микроорганизмов у рыб: морфология, локализация и диагностические особенности.","title":"Гранулёмы и внутриклеточные агенты у рыб"},{"content":"\nГлубина разбора F. F.O. F.O.S. Переключить Миф / Реальность\rПлавниковая гниль — распространённая бактериальная болезнь Плавниковая гниль — одно из самых распространённых заболеваний аквариумных рыб. С этой проблемой рано или поздно сталкивается практически каждый аквариумист.\nОпределить болезнь обычно несложно даже без специальных приборов. Основной признак — разрушение плавников. Сначала края плавников становятся неровными, как будто обтрёпанными, затем они начинают постепенно укорачиваться. Иногда края белеют или мутнеют, а в тяжёлых случаях можно заметить покраснение у основания плавников.\nПричиной плавниковой гнили считаются бактерии, которые начинают активно развиваться в аквариуме при неблагоприятных условиях. Чаще всего болезнь появляется из-за загрязнения воды, редких подмен, перекорма, перенаселения аквариума или сильного стресса у рыб.\nОслабленная рыба теряет иммунитет, и бактерии начинают разрушать ткани плавников. Если не принять меры, процесс может распространяться дальше и привести к серьёзному повреждению плавников или даже гибели рыбы.\nОпытные аквариумисты обычно могут определить плавниковую гниль даже визуально, по характерному виду разрушенных плавников. В таких случаях важно не затягивать с лечением.\nДля лечения чаще всего применяют антибактериальные препараты. Хорошо помогают метиленовая синь, малахитовый зелёный, различные комплексные средства против бактериальных инфекций, а также антибиотики. Иногда используют солевые ванны или повышение температуры воды.\nТакже рекомендуется улучшить условия содержания: сделать подмену воды, убрать остатки корма, проверить фильтрацию и снизить нагрузку на аквариум.\nЕсли начать лечение вовремя, плавники у рыб обычно постепенно восстанавливаются, а болезнь удаётся остановить на ранней стадии.\nfanfishka.ru tropica.ru Плавниковая гниль: что именно разрушается? Увидев рыбу с обтрёпанными, укороченными или побелевшими по краям плавниками, мы нередко сразу произносим знакомое название: «плавниковая гниль». Следом появляется объяснение: «бактерии разъедают плавники», а затем — предложение лечить антибактериальными препаратами.\nПроблема в том, что разрушение плавника — наблюдаемое изменение, а бактериальная инфекция — одно из возможных его объяснений. По одному только виду края плавника нельзя установить последовательность событий: что повредилось первым, почему это произошло и какую роль сыграли микроорганизмы.\nПлавник может разрушаться при инфекции, травмировании и неинфекционных патологических процессах. Одинаковый внешний результат не означает одинаковую причину.\n«Гниль» и «эрозия»: почему слова имеют значение В аквариумистике «плавниковой гнилью» часто называют любое укорочение и разрушение плавников. Но такое название заранее склоняет к инфекционному объяснению.\nВ научных работах встречается термин fin erosion — эрозия плавников. Sharples и Evans (1996) применяли его для описания особого патологического процесса, при котором не было выявлено существенного участия микроорганизмов, и предлагали отличать эту форму поражения от инфекционной fin rot.\nОднако нельзя просто переименовать любой обтрёпанный плавник в fin erosion и считать причину установленной. Эрозия описывает повреждение ткани; её механизм и этиология требуют отдельного рассмотрения. Даже бактериальный колумнариоз способен сопровождаться эрозией плавников (Declercq et al., 2013).\nКак устроен плавниковый луч Строение плавниковых лучей. A — сегментированные лепидотрихии. B — поперечное сечение лепидотрихия с двумя полусегментами. Плавники костистых рыб поддерживаются лепидотрихиями — сегментированными плавниковыми лучами кожного происхождения. Это не сплошные костные стержни. Каждый луч образован двумя изогнутыми полусегментами; вдоль луча сегменты соединены связками. Между полусегментами проходят сосуды, нервы и соединительная ткань. Соседние лучи также связаны друг с другом, а вся конструкция окружена мягкими тканями плавника (Sharples \u0026amp; Evans, 1996).\nТакое строение важно для понимания повреждений: потеря связи между элементами способна выглядеть как расслоение, распушение или фрагментация плавникового луча. Сам по себе подобный вид ещё не объясняет, почему связи нарушились.\nЧто показывает опыт под бинокуляром Ваш браузер не поддерживает видео. Расслоение плавникового луча под бинокуляром На видео препаровальная игла воздействует на повреждённый луч. Его сегментированные элементы расходятся, тогда как на исследуемом участке сохраняются различимые мягкие ткани.\nЧто мы увидели? Определённые элементы плавникового луча способны расходиться по местам соединений под механической нагрузкой.\nЧего мы этим не установили? Почему они оказались ослаблены или повреждены до исследования. Причиной могли быть предшествующая травма, изменения мягких тканей или иной патологический процесс. Для ответа нужны сведения о состоянии рыбы, условиях содержания и исследование самого поражения.\nВидео показывает механизм расхождения элементов луча при воздействии иглой. Оно не является опытом, который исключает бактериальную причину поражения у живой рыбы.\nМожет ли плавник разрушаться без бактериальной инфекции? Да. И это не только теоретическое предположение.\nSharples и Evans (1996) исследовали эрозию плавников у золотых рыбок (Carassius auratus), обитавших на участке реки, подвергавшемся воздействию стоков целлюлозно-бумажного производства. Гистологические исследования показали последовательность тканевых изменений.\nСначала страдали наружные структуры эпидермиса: утрачивались кутикула и микрорельеф поверхности клеток, развивались повреждение и слущивание эпителиальных клеток. По мере прогрессирования процесса появлялись отёк, изменения дермы, а позднее — повреждение лепидотрихий. В исследованных образцах явное участие бактерий наблюдалось редко и рассматривалось как вероятно вторичное явление (Sharples \u0026amp; Evans, 1996).\nЭто особенно важный пример: плавник может укорачиваться и разрушаться без установленной первичной бактериальной инфекции. При этом авторы не утверждали, что установили универсальную причину всех подобных поражений у рыб.\nА питание, обмен веществ и трофика? Эту возможность тоже нельзя отбрасывать. Питание, минеральный обмен и физиологическое состояние рыбы влияют на сохранность и восстановление тканей. Для плавников важны не только твёрдые элементы лучей, но и эпителий, соединительная ткань, сосуды и механические связи между ними.\nОднако здесь нужно отделить обоснованную рабочую гипотезу от установленного механизма конкретного поражения. Например, если у рыбы имеются нарушения питания, обмена веществ или хроническое системное заболевание, они могут влиять на состояние тканей и их восстановление. Но сама эрозия плавника ещё не доказывает, что её вызвало нарушение трофики.\nВ частности, объяснение «дистальные отделы разрушаются первыми, потому что имеют самый низкий приоритет кровоснабжения» требует прямых физиологических и морфологических подтверждений. Общие исследования минерального обмена рыб не доказывают такой последовательности для любого случая разрушения плавников (Lall \u0026amp; Kaushik, 2021).\nТаким образом, нарушение трофики — возможное направление поиска причины, а не автоматическая альтернатива бактериальной инфекции.\nКогда бактерии действительно могут быть причиной Бактерии, встречающиеся при инфекционном разрушении плавников. Слева — нитевидные формы, справа — мелкие палочковидные бактерии. Не стоит делать и обратную ошибку: объявлять любую бактериальную инфекцию вторичной.\nХороший пример — колумнариоз, вызываемый бактериями группы Flavobacterium columnare (с учётом современных таксономических изменений внутри этого комплекса). Для него описаны поражения кожи, жабр и плавников, включая эрозию плавников (Declercq et al., 2013).\nНо есть и другая ситуация: ткань повреждена раньше, а бактерии заселяют уже изменённую поверхность. Рыбы постоянно контактируют с микроорганизмами; кожа и слизь участвуют в иммунной защите и одновременно взаимодействуют с нормальной микробиотой (Gomez et al., 2013); (Reverter et al., 2018).\nПоэтому находка бактерий на повреждённом плавнике имеет значение, но её недостаточно для ответа на вопрос «кто начал разрушение?». Важны тип бактерий, характер поражения, их связь с тканевыми изменениями и, по возможности, динамика процесса.\nКак разбирать конкретный случай Начинать полезно не с названия лекарства, а с последовательности вопросов.\nЧто изменилось? Разрушаются только кончики, отдельные лучи или вся перепонка? Есть ли воспаление, кровоизлияния, некроз, слизь, налёт, повреждения тела и жабр? Как развивался процесс? Повреждения появились за часы или формировались неделями? Есть ли признаки травмирования, агрессии соседей, контакта с оборудованием? Кого затронуло? Одну рыбу, определённый вид или сразу разные виды в общей системе? Не менялись ли недавно параметры воды и условия содержания? Что показывает микроскопия? Какие структуры сохраняются, какие повреждены, видны ли микроорганизмы в связи с участком поражения, есть ли клеточная реакция? Что ещё нужно подтвердить? При подозрении на бактериальную инфекцию могут понадобиться целенаправленный отбор материала, культуральное исследование, молекулярные методы или гистология. Они выбираются в зависимости от задачи и доступности. Микроскопия помогает уточнить характер повреждения, но и сама по себе не всегда устанавливает его этиологию. С другой стороны, отсутствие возможности сразу выполнить посев или ПЦР — не повод отказаться от наблюдений, описания изменений и проверки условий среды.\nДиагноз должен объяснять повреждение плавника, а не просто повторять его внешний вид другим словом.\nВывод Название «плавниковая гниль» удобно в разговоре, но слишком часто используется как готовый диагноз. Между тем за сходной внешней картиной могут стоять разные процессы: травма, неинфекционная эрозия, первичная бактериальная инфекция или вторичное заселение повреждённых тканей микроорганизмами.\nВидео с лепидотрихиями показывает, как устроенная из отдельных элементов тканевая конструкция может расслаиваться. Исследования неинфекционной эрозии показывают, что разрушение плавника не требует обязательного участия бактерий. А работы по колумнариозу напоминают, что бактериальное повреждение тоже вполне реально.\nГлавное — не выбирать причину по привычному названию. Сначала описать, что происходит, затем проверить возможные механизмы и только после этого решать, чем и от чего лечить.\nЛитература Sharples, A. D., Evans, C. W. (1996). Pathology of fin erosion in goldfish Carassius auratus. Diseases of Aquatic Organisms, 24, 81–91. https://doi.org/10.3354/dao024081 Declercq, A. M., Haesebrouck, F., Van den Broeck, W., Bossier, P., Decostere, A. (2013). Columnaris disease in fish: a review with emphasis on bacterium-host interactions. Veterinary Research, 44, 27. https://doi.org/10.1186/1297-9716-44-27 Gomez, D., Sunyer, J. O., Salinas, I. (2013). The mucosal immune system of fish: the evolution of tolerating commensals while fighting pathogens. Fish \u0026amp; Shellfish Immunology, 35, 1729–1739. https://doi.org/10.1016/j.fsi.2013.09.032 Lall, S. P., Kaushik, S. J. (2021). Nutrition and metabolism of minerals in fish. Animals, 11, 2711. https://doi.org/10.3390/ani11092711 Reverter, M., Tapissier-Bontemps, N., Lecchini, D., Banaigs, B., Sasal, P. (2018). Biological and ecological roles of external fish mucus: a review. Fishes, 3, 41. https://doi.org/10.3390/fishes3040041 Вопросы и ответы Всегда ли разрушение плавников — бактериальная гниль? Нет. Сходные внешние изменения возможны при неинфекционной эрозии, травмах и бактериальных заболеваниях.\nПочему плавники становятся «обтрёпанными»? Повреждаться могут эпителий, соединительная ткань и связи между сегментами плавниковых лучей. Разные механизмы способны давать сходный внешний результат.\nМожно ли по видео с препаровальной иглой определить причину? Нет. Видео показывает расхождение элементов луча при механическом воздействии. Причину предшествовавшего повреждения нужно устанавливать отдельно.\nНужно ли сразу использовать антибиотики? Нет. Сначала следует оценить характер поражения, условия содержания и основания для подозрения на бактериальную инфекцию. Выбор лечения зависит от предполагаемого или подтверждённого процесса.\nЧем помогает микроскопия? Позволяет оценить ткани и обнаружить возможные микроорганизмы. Но их присутствие на поверхности повреждения не всегда доказывает, что именно они начали патологический процесс.\n","permalink":"https://fossamethod.ru/ru/posts/finerosion/","summary":"Почему разрушенный плавник ещё не означает бактериальную гниль. Видео расслоения лепидотрихий, научные данные о неинфекционной эрозии и первичных бактериальных поражениях.","title":"Плавниковая гниль"},{"content":"\rПереключить Миф / Реальность\rС гексамитами всё давно понятно, тут и разбираться особо не в чем. Гексамиты в кишечнике\rПрактически у всех цихлид (и не только у них) гексамитиды есть всегда. Это нормальные внутренние паразиты, часть кишечной микрофлоры. Они живут в организме рыбы постоянно и в обычных условиях никак себя не проявляют. Многие рыбы с ними живут годами — значит, ничего страшного в этом нет.\nКакие именно это гексамиты — не принципиально. Hexamita, Spironucleus, Cryptobia — по сути одно и то же, просто разные названия. Все они вызывают одни и те же проблемы и лечатся одинаково, поэтому разбираться в систематике смысла нет. Для аквариумиста важен не латинский род, а результат.\nПроблемы начинаются при стрессе: подмена воды, падение температуры, переезд, конфликт с соседями, нерест или просто ослаб иммунитет. В этот момент гексамиты активируются и начинается гексамитоз. Паразиты до этого спокойно жили внутри, а потом вышли из-под контроля.\nОпределить болезнь легко и без всякой диагностики. Если у рыбы белый или прозрачный кал, она худеет, темнеет, отказывается от корма — это почти всегда гексамитоз. Эти признаки давно известны и проверены практикой, микроскоп тут не нужен. Соскобы и мазки — лишний стресс, который только ухудшает состояние рыбы.\nЛечение тоже всем известно. Основное средство — метронидазол. Его используют давно и успешно, иногда с повышением температуры, солью или усиленной аэрацией. Если не помогает — увеличивают дозу или повторяют курс. Некоторые добавляют метро в корм, другие льют в воду — принципиальной разницы нет.\nПолностью избавиться от гексамит невозможно. Даже если пролечить рыбу, паразиты всё равно остаются внутри и просто временно подавляются. Поэтому лечение — это не уничтожение, а контроль. Главное — вовремя заметить симптомы и не запускать процесс.\nЧасто говорят, что гексамит можно занести с новой рыбой, но это не обязательно. Они и так уже есть в организме. Просто при плохих условиях они активируются. Поэтому основная профилактика — хорошая вода и отсутствие стресса, а не карантины и изоляции.\nВ целом гексамитоз — это не столько болезнь, сколько показатель плохих условий содержания. Улучшишь уход, подлечишь метронидазолом — и всё снова придёт в норму.\nfanfishka.ru — «Гексамитоз у цихлид»\nРыбы не нуждаются в гексамитидах Ваш браузер не поддерживает видео. Гексамиты в кишечнике Кишечные жгутиконосцы рода Hexamita и Spironucleus не являются обязательным компонентом физиологии рыб.\nОтсутствие этих паразитов не ухудшает пищеварение, рост или выживаемость, что принципиально отличает их от истинных симбионтов\n(Dyková \u0026amp; Lom, 1981; Paperna, 1996).\nПрактика рыбоводства и публичных аквариумов показывает, что популяции рыб без кишечных флагеллят:\nдемонстрируют более стабильный рост; имеют меньшую смертность молоди; реже сталкиваются с хроническим истощением\n(Cruz-Lacierda \u0026amp; Subasinghe, 1998). Асимметрия зависимости «хозяин–паразит» Связь между рыбой и гексамитидами является асимметричной:\nрыба способна существовать без паразита; паразит не способен существовать без хозяина. Это фундаментальный принцип паразитологии, применимый к большинству аквариумных паразитов\n(Paperna, 1996; Burreson et al., 2006).\nСледовательно, отсутствие гексамитид — нормальное и устойчивое состояние, а не «стерильная аномалия».\nПочему возникает миф о «нормальной микрофлоре» Идея «нормальной микрофауны кишечника» формируется из-за смешения понятий:\nМикробиота ≠ простейшие паразиты\nТермины, относящиеся к бактериальной микрофлоре, ошибочно переносятся на эукариотических паразитов\n(Llewellyn et al., 2014).\nСубклиническое течение\nНизкая численность паразита может не сопровождаться выраженными симптомами, но это не делает его физиологической нормой\n(Kent et al., 2004).\nОтсутствие диагностики\nВо многих системах наличие гексамитид не проверяется микроскопически, а выводы делаются по неспецифическим признакам.\nБелый кал — не диагноз Белый или слизистый кал не является специфическим признаком гексамитидной инвазии.\nПодобный симптом может наблюдаться при:\nголодании; бактериальных энтеритах; воспалении кишечника иной этиологии; интоксикациях; нарушении функции печени и поджелудочной железы\n(Kent et al., 2004). Без микроскопического подтверждения этиологию заболевания установить невозможно.\nПочему вспышки действительно возникают Гексамитиды не «активируются» сами по себе.\nРост их численности связан с конкретными эпизоотологическими факторами:\nзанос с новой рыбой; высокая плотность посадки; хронический стресс; нарушение питания; ослабление барьерной функции кишечника\n(Cruz-Lacierda \u0026amp; Subasinghe, 1998; Tort et al., 2016). Стресс в этой схеме является модифицирующим фактором, но не источником паразита.\nГлавное следствие Гексамитиды — не обязательный и не желательный компонент аквариумной системы.\nИх присутствие следует рассматривать как фактор риска, а не как физиологическую норму.\nРыбы не нуждаются в гексамитидах.\nГексамитиды нуждаются в рыбах.\nЛитература Dyková, I., Lom, J., 1981. Hexamita salmonis and related flagellates of fish. Folia Parasitologica 28, 153–166. Paperna, I., 1996. Parasites, infections and diseases of fishes in Africa: An update. FAO, Rome. Cruz-Lacierda, E.R., Subasinghe, R.P., 1998. Occurrence and control of intestinal flagellates in freshwater fish culture. Aquaculture Research 29, 697–703. Kent, M.L., et al., 2004. Diagnostic procedures for diseases of fish and shellfish. American Fisheries Society, Bethesda. Llewellyn, M.S., Boutin, S., Hoseinifar, S.H., Derome, N., 2014. Teleost microbiomes: the state of the art. Frontiers in Microbiology 5, 207. Tort, L., Balasch, J.C., Mackenzie, S., 2016. Fish immune system: a crossroads between innate and adaptive responses. Fish \u0026amp; Shellfish Immunology 53, 1–12. Burreson, E.M., et al., 2006. Parasites and diseases of marine organisms. Springer. Частые вопросы Белый кал у рыбы — это точно гексамитоз?\nНет. Это частый, но неспецифический признак. Без микроскопии это может быть что угодно — от голодания до других паразитов.\nГексамиты есть у всех рыб?\nНет. Они не являются нормальной частью организма. Их наличие — результат заноса.\nПочему рыба худеет, хотя ест?\nПища может не усваиваться из-за поражения кишечника. Внешне рыба ест, но фактически истощается.\nМожно ли лечить “на всякий случай” метронидазолом?\nНет. Без подтверждения это лечение вслепую, которое может не помочь и ухудшить ситуацию.\nГлавная причина вспышек — стресс?\nНет. Стресс может усугубить состояние, но сам по себе не создаёт паразита.\n","permalink":"https://fossamethod.ru/ru/posts/hexa/","summary":"Рыбы не нуждаются в гексамитидах. Паразиты нуждаются в рыбах. Почему вспышки связаны не с «активацией», а с заносом и нарушением баланса.","title":"Гексамитиды"},{"content":"\nПереключить Миф / Реальность\rИхтиофтириус есть в каждом аквариуме! Данный паразит присутствует в системе постоянно и активируется только при ухудшении условий содержания!. Стресс, падение температуры, подмена воды или конфликт между рыбами активируют паразита, который до этого находился в аквариуме в спящем состоянии.\nВсе давно знают, что ихтиофтириус образует устойчивые цисты, которые могут длительно сохраняться в субстрате, фильтрах и декорациях. Даже после длительного отсутствия симптомов инфекция никуда не исчезает, а лишь переходит в скрытую форму.\nНередко можно услышать, что болезнь не обязательно заносится извне\u0026hellip;но она появляется при ухудшении качества воды, перекорме или неправильном уходе!. Согласно этому - стресс сам по себе способен вызвать появление паразита!.\nВодопроводная вода может содержать «плавающие цисты». Цисты паразита могут находиться даже в водопроводной воде. Поэтому любые подмены воды рассматриваются как потенциальный источник заражения, независимо от происхождения и обработки воды.\nЛечение не устраняет паразита полностью. Препараты способны лишь временно подавлять симптомы. Считается, что паразит всё равно остаётся в системе и рано или поздно снова проявится при любом неблагоприятном факторе.\nfanfishka.ru ekzotika.com Почему термин \u0026ldquo;циста\u0026rdquo; вводит аквариумистов в заблуждение Ваш браузер не поддерживает видео. Деление фтириуса В классической литературе стадия деления Ichthyophthirius multifiliis описывается как encysted tomont (Dickerson and Clark, 1996; Matthews, 2005). У I. multifiliis действительно присутствует цистоподобная стадия (encysted tomont), однако она относится к категории репродуктивных цист. В отличие от классических покоящихся криптобиотических цист многих протистов, эта оболочка тонкая, временная и предназначена для палинтомического деления, а не для длительной персистенции во внешней среде .\nТермин \u0026ldquo;персистенция\u0026rdquo; - способность микроорганизма (вируса, бактерии, грибка) или химического вещества сохранять свою жизнеспособность или структуру вне организма хозяина в течение долгого времени.\nВ классической протозоологии слово \u0026ldquo;циста\u0026rdquo; используется шире, чем «покоящаяся сверхустойчивая циста амёб». Исторически encystment означает: \u0026ldquo;образование оболочки вокруг клетки — независимо от толщины, функции и степени устойчивости\u0026rdquo; (Corliss, 2001; Kudo, 1954). То есть в паразитологической традиции:\nциста ≠ обязательно покой циста ≠ обязательно толстая стенка циста = клетка в оболочке Поэтому термин используют корректно в рамках своей школы.\nТип цисты Примеры организмов Основная функция Структура оболочки Метаболическая активность Устойчивость во внешней среде Криптобиотическая (покоящаяся) Амёбы, колподиды Переживание неблагоприятных условий, расселение Толстая, многослойная, плотная Резко снижена (криптобиоз) Высокая, длительное сохранение Споровая / персистентная Миксоспоридии, апикомплексы (споры) Передача между хозяевами Специализированная, прочная Минимальная Очень высокая Репродуктивная (палинтомическая) Ichthyophthirius multifiliis (томонт), некоторые апостомы Быстрое множественное деление Тонкая, временная, слабая Высокая, активное деление Низкая, кратковременная стадия Корректно: Ихтиофтириус образует тонкостенную неустойчивую репродуктивную цисту.\nМиф о «вездесущем» ихтиофтириусе Ихтиофтириус\rИсторическая справка. На протяжении веков существовало представление, что живые организмы способны возникать из неживой материи — например, личинки из гниющего мяса или микроорганизмы из грязи и воды. Эксперименты Франческо Реди (1668), показавшие связь появления личинок с доступом мух к мясу, а позднее работы Луи Пастера (1859) с колбами с изогнутым горлышком окончательно опровергли эту идею. Было доказано фундаментальное биологическое положение: жизнь возникает только из предшествующей жизни (omne vivum ex vivo). Это правило лежит в основе современной микробиологии, паразитологии и эпизоотологии.\nПосле разъяснения жизненного цикла становится очевидно: I. multifiliis не способен «ждать своего часа» в аквариуме годами. У паразита отсутствует длительная спящая стадия, способная переживать неблагоприятные условия или длительное отсутствие хозяина. Это означает, что он не может постоянно присутствовать в системе без непрерывной передачи между рыбами.\nПочему паразит не может «просто лежать и ждать»? Все известные стадии жизненного цикла активны:\nТрофонт питается и растёт в тканях рыбы; Томонт активно делится; Теронт активно ищет хозяина и быстро погибает без него. Ни одна стадия не предназначена для многомесячного выживания без метаболической активности.Если в системе отсутствуют восприимчивые рыбы, жизненный цикл паразита обрывается естественным образом.\nСледовательно:\nПаразит не может годами сохраняться в грунте без хозяина; Не способен «просыпаться» после длительного покоя; Не возникает спонтанно при ухудшении условий. Стресс у рыбы может усилить уже существующую инфекцию, но не создаёт паразита из ничего (См. справку выше).\nПочему миф выглядит правдоподобно?\nСубъективное ощущение «он был всегда» возникает из-за типичных эпизоотологических ошибок:\nСкрытое носительство: рыбы могут переносить небольшое количество паразитов без выраженных симптомов. После стресса или изменения условий численность паразита резко возрастает, создавая иллюзию внезапного появления.\nНеполное лечение: если терапия прекращена раньше времени, часть паразитов сохраняется и позже вызывает повторную вспышку.\nПостоянные микро-заносы: паразит может попадать в систему с новой рыбой, водой из других аквариумов, растениями, инвентарём и даже руками человека после контакта с заражённой системой.\nОшибки диагностики Под «манку» могут принимать другие заболевания кожи и жабр, из-за чего разные проблемы воспринимаются как «возвращение одного и того же паразита».\nПро водопроводную воду и «плавающие цисты»\nУтверждения о постоянном присутствии ихтиофтириуса в водопроводной воде не согласуются с его биологией :\nИнфективная стадия требует живого хозяина в ограниченные сроки (Farley and Heckmann, 1980; Matthews, 2005); Активные стадии плохо переносят длительное отсутствие рыбы (Post, 1987); Стандартная подготовка водопроводной воды (фильтрация, реагенты, транспортировка) крайне неблагоприятна для выживания паразита (Lahnsteiner and Weismann, 2007). На практике сообщения о «цистах в водопроводе» чаще всего связаны с ошибочной идентификацией свободноживущих инфузорий или загрязнением проб.\nГлавное следствие Ихтиофтириус не является обязательным компонентом любого аквариума. Если паразит обнаружен — значит, он был занесён и продолжает циркулировать между рыбами. Контроль инфекции строится не на борьбе с мифическими «спящими формами», а на:\nКарантине новых рыб; Эпизоотологическом контроле системы; Корректной и завершённой терапии; Предотвращении перекрёстного переноса между аквариумами. Литература Corliss, J.O., 2001. Protozoan Cysts and Spores, in: Encyclopedia of Life Sciences. John Wiley \u0026amp; Sons, Ltd. https://doi.org/10.1038/npg.els.0001934 Dickerson, H., Clark, T., 1996. Immune response of fishes to ciliates. Annual Review of Fish Diseases 6, 107–120. https://doi.org/10.1016/S0959-8030(96)90008-3 Farley, D.G., Heckmann, R., 1980. Attempts to control Ichthyophthirius multifiliis Fouquet (Ciliophora: Ophryoglenidae) by chemotherapy and electrotherapy. Journal of Fish Diseases 3, 203–212. https://doi.org/10.1111/j.1365-2761.1980.tb00444.x Kudo, R.R., 1954. Protozoology, 4th ed. Springfield, Illinois. Lahnsteiner, F., Weismann, T., 2007. Treatment of ichthyophthiriasis in rainbow trout and common carp with common and alternative therapeutics. Journal of Aquatic Animal Health 19, 186–194. https://doi.org/10.1577/H07-002.1 Matthews, R.A., 2005. Ichthyophthirius multifiliis Fouquet and Ichthyophthiriosis in Freshwater Teleosts, in: Advances in Parasitology. Elsevier, pp. 159–241. https://doi.org/10.1016/S0065-308X(05)59003-1 Post, G., 1987. Textbook of Fish Health. Частые вопросы Ихтиофтириус есть в каждом аквариуме?\nНет. Он появляется только при заносе. Сам по себе не возникает.\nБелые точки всегда означают ихтиофтириоз?\nНет. Похожие симптомы могут давать другие паразиты или повреждения кожи.\nМожно ли заразиться через воду из-под крана?\nПрактически нет. Основной путь — занос с рыбой или оборудованием.\nПочему болезнь возвращается после лечения?\nЧаще всего это повторный занос или незавершённый цикл лечения, а не “скрытая форма”.\nЦиста — это стадия покоя?\nНет. У ихтиофтириуса это стадия деления, а не длительного выживания.\n","permalink":"https://fossamethod.ru/ru/posts/ichthyophthirius/","summary":"Разбор биологии Ichthyophthirius multifiliis. Миф о вездесущем паразите и реальные механизмы распространения.","title":"Ихтиофтириоз без мифов"},{"content":"\rРыбы — это не один организм и не один тип «пациента», а огромная группа позвоночных животных, насчитывающая более 34 000 видов. Для сравнения: человек — это всего лишь один вид, Homo sapiens. Рыбы же — это тысячи форм жизни с различной анатомией, физиологией и стратегиями выживания.\nНесмотря на огромное разнообразие, большинство рыб объединяет физиологическая адаптация к жизни в водной среде. Их кожа, слизистый покров, дыхательная система и поведение сформированы эволюцией таким образом, чтобы функционировать в воде, а не при контакте с сухими поверхностями и грубыми объектами. Некоторые виды активно взаимодействуют с грунтом, камнями или субстратом — например, донные рыбы, зарывающиеся в песок, — и их покровы адаптированы к механическому воздействию. Однако даже такие рыбы остаются чувствительными к неправильному обращению вне естественной среды.\nРыбы постоянно находятся в контакте с огромным количеством микроорганизмов. Вода не является стерильной средой, и кожа рыбы вместе со слизью формирует активный защитный барьер. В слизистом слое присутствуют антимикробные вещества и клетки иммунной системы, поддерживающие устойчивое равновесие между организмом хозяина и окружающей микрофлорой. Именно поэтому само наличие бактерий на коже или жабрах не означает болезнь — патологический процесс начинается тогда, когда нарушается барьер или общее состояние организма.\nСреди аквариумистов широко распространено мнение, что серьёзная диагностика неизбежно заканчивается гибелью рыбы. Это не соответствует действительности. Большинство первичных диагностических процедур — внешний осмотр, оценка состояния кожи и плавников, взятие соскобов и мазков, исследование жаберной слизи — являются нелетальными манипуляциями, которые при правильном выполнении не представляют угрозы для жизни пациента. Более того, ранняя диагностика часто позволяет избежать тяжёлых состояний, требующих радикальных вмешательств.\nВ моей практике действует простое правило - если мне что-то нужно - скорее всего это уже было нужно ещё кому-то и, возможно, решение найдено...стоит поискать, проверить. Семь миллиардов людей на планете...не забывайте.\rВот примеры научных рецензируемых статей на тему нелетальных манипуляций с рыбами:\n«Assessing the suitability of a non-lethal biopsy punch for sampling fish muscle tissue» - Биопсия мышечной ткани 4 миллиметровым экстрактором, фото заживших ран приведены (Henderson et al., 2016). «Best practices for non-lethal blood sampling of fish via the caudal vasculature» - Методы взятия крови из хвостового стебля. Фото приведены (Lawrence et al., 2020). «Nonlethal clinical techniques used in the diagnosis of diseases of fish» - Сосокоб покровным стеклом, бакпосев тубфером. Открезают дистальную часть жаберных лепестков и край плавника (я такое не приветствую). Рыбки живы (Smith, 2002). «Non-Lethal Sampling Supports Integrative Movement Research in Freshwater Fish. Front» - Обзорная статья по методам взятия различных проб нелетальными методами. В основном - молекулярка и подобное (Thorstensen et al., 2022). «Skin swabbing protocol to collect DNA samples from small-bodied fish species» - сравнивается поведение рыб и экспрессия генов после обрезания плавника и взятия мазка с кожи (Tilley et al., 2024). В общем, манипуляции методически простые, но требующие аккуратности и понимания анатомии... и не требующие сложного или дорогостоящего оборудования при базовой подготовке. Так что в в мире науки пробы брать можно. Любителям часто мешают стереотипы и страх перед манипуляциями.\rСсылка на страницу \u0026ldquo;Что делать с рыбой после приезда.\u0026rdquo; - там приведены манипуляции\u0026hellip;в картинках.\nСсылка на страницу \u0026ldquo;Хирургические операции на гидробионтах\u0026rdquo; - это возможно\u0026hellip;они выживают.\nСсылка на страницу с презентацией \u0026ldquo;Прижизненная диагностика рыб в условиях океанариума: мониторинг здоровья и современные методы\u0026rdquo;\nБазовое правило любой работы с рыбой — минимизация травмы и стресса. Даже простое использование медицинских перчаток имеет значение: они защищают слизистый покров от повреждений, предотвращают перенос химических веществ с кожи человека и снижают риск занесения условно-патогенной микрофлоры в повреждённые ткани. Нелетальные методы диагностики — это не «экзотическая ветеринария», а нормальная практика, доступная при наличии аккуратности, понимания анатомии и желания работать с пациентом независимо от его размера.\nПочему рыбы не умирают от диагностики — и почему иногда умирают после неё Одним из самых устойчивых мифов в аквариумистике остаётся убеждение, что сама диагностика опасна и может привести к гибели рыбы. Особенно часто это мнение возникает в ситуациях, когда ослабленный пациент погибает вскоре после осмотра или взятия проб. Однако в большинстве случаев подобная связь является временным совпадением, а не причинно-следственным механизмом.\nКомпенсаторные возможности организма рыбы Рыбы эволюционно адаптированы к постоянному контакту с окружающей средой, насыщенной микроорганизмами и механическими воздействиями. Их кожа и слизистый покров представляют собой активную защитную систему, содержащую антимикробные вещества и клетки иммунной защиты. Жабры обладают огромной поверхностью контакта с водой и ежедневно подвергаются воздействию частиц, микрофлоры и изменяющихся гидрохимических условий.\nВ естественной среде рыбы регулярно получают микроповреждения: при контакте с грунтом, кормом, другими организмами и элементами среды. Именно поэтому минимально инвазивные диагностические процедуры — внешний осмотр, взятие соскобов, мазков или исследование жаберной слизи — по уровню воздействия сопоставимы с обычными нагрузками, которые организм способен переносить без угрозы для жизни.\nКогда смерть совпадает с манипуляцией Иногда гибель рыбы действительно происходит вскоре после осмотра. Это создаёт иллюзию, что причиной стала сама процедура. Однако на практике чаще всего речь идёт о пациентах, находящихся в стадии глубокой декомпенсации.\nДекомпенсация организма — это срыв или истощение приспособительных механизмов, при котором орган или система перестают справляться с нагрузкой, вызывая резкое ухудшение состояния. Это состояние характеризуется быстрым нарастанием симптомов, требующим немедленной медицинской помощи и часто госпитализации. Ключевые причины включают хронические болезни, стресс, истощение или интоксикацию\rПри тяжёлых системных нарушениях компенсаторные механизмы организма уже исчерпаны. В таком состоянии даже минимальный стресс — извлечение из воды, изменение гидростатического давления, кратковременная гипоксия или возбуждение — может стать пусковым фактором финального ухудшения. Манипуляция в этих случаях не вызывает заболевание и не создаёт патологию, а лишь совпадает по времени с её завершающей стадией.\nКлинические признаки терминального состояния Практический опыт показывает, что рыбы, погибающие при минимальных вмешательствах, зачастую уже имеют выраженные системные нарушения.\nОдним из характерных признаков является атония кишечника и утрата сфинктерного контроля. При тяжёлых метаболических и воспалительных процессах кишечник теряет тонус, и любое изменение положения тела или давления жидкости может приводить к пассивному выделению содержимого. Это не реакция на осмотр, а проявление глубокой функциональной недостаточности организма.\nАтония — это патологическое состояние, характеризующееся резким снижением или полным отсутствием тонуса мышц внутренних органов (чаще кишечника или желудка) или скелетной мускулатуры, что ведет к нарушению их функции.\rДругой распространённый вариант — выраженные метаболические нарушения, включая жировую инфильтрацию внутренних органов. При этом снижается гемодинамический резерв, уменьшается способность сосудистой системы компенсировать стресс и изменения давления. Такие рыбы плохо переносят возбуждение и физическое воздействие не из-за самой процедуры, а из-за уже сформированной системной патологии.\nТакже часто наблюдаются:\nобщая мышечная слабость и потеря координации; выраженные нарушения дыхания; истощение или, наоборот, тяжёлые метаболические перегрузки; хронические воспалительные процессы внутренних органов. Во всех этих случаях смерть после манипуляции является следствием исходного состояния пациента, а не диагностического вмешательства.\nВывод Если рыба погибает после кратковременного осмотра или минимальной диагностической процедуры, это чаще всего свидетельствует о крайне тяжёлом исходном состоянии организма. Манипуляция выступает не причиной заболевания, а последним стрессовым фактором, ускорившим уже развивавшийся патологический процесс.\nИменно поэтому отказ от диагностики не делает лечение безопаснее. Напротив, ранний осмотр и своевременное выявление проблем позволяют вмешаться до стадии декомпенсации — тогда, когда у организма ещё есть ресурсы для восстановления. Литература Henderson, C.J., Stevens, T.F., Lee, S.Y., 2016. Assessing the suitability of a non-lethal biopsy punch for sampling fish muscle tissue. Fish Physiol Biochem 42, 1521–1526. https://doi.org/10.1007/s10695-016-0237-z Lawrence, M.J., Raby, G.D., Teffer, A.K., Jeffries, K.M., Danylchuk, A.J., Eliason, E.J., Hasler, C.T., Clark, T.D., Cooke, S.J., 2020. Best practices for non-lethal blood sampling of fish via the caudal vasculature. Journal of Fish Biology 97, 4–15. https://doi.org/10.1111/jfb.14339 Smith, S.A., 2002. Nonlethal clinical techniques used in the diagnosis of diseases of fish. J Am Vet Med Assoc 220, 1203–1206, 1162. https://doi.org/10.2460/javma.2002.220.1203 Thorstensen, M.J., Vandervelde, C.A., Bugg, W.S., Michaleski, S., Vo, L., Mackey, T.E., Lawrence, M.J., Jeffries, K.M., 2022. Non-Lethal Sampling Supports Integrative Movement Research in Freshwater Fish. Front. Genet. 13. https://doi.org/10.3389/fgene.2022.795355 Tilley, C., Barber, I., Norton, W., 2024. Skin swabbing protocol to collect DNA samples from small-bodied fish species. F1000Res 10, 1064. https://doi.org/10.12688/f1000research.73115.2 Частые вопросы Рыба может умереть от соскоба?\nНет, если он выполнен правильно. Это базовая и безопасная процедура.\nПочему рыба погибает после осмотра?\nЧаще всего она уже была в тяжёлом состоянии, а не погибла из-за диагностики.\nНужно ли избегать любых манипуляций?\nНет. Отсутствие диагностики часто опаснее самой процедуры.\nМожно ли брать пробы у маленьких рыб?\nДа. Размер не является ограничением при аккуратной работе.\nЧто важнее — не трогать рыбу или поставить диагноз?\nДиагноз. Без него невозможно принять правильное решение.\n","permalink":"https://fossamethod.ru/ru/posts/size/","summary":"Рыбы — это не один организм и не один тип «пациента», а огромная группа позвоночных животных, насчитывающая более 34 000 видов. Для сравнения: человек — это всего лишь один вид, \u003cem\u003eHomo sapiens\u003c/em\u003e.","title":"Размер пациента не важен / почему рыбы не умирают от диагностики"},{"content":"\rЕсли в аквариуме по непонятным причинам дохнет рыба: Пересадите всех рыб в другую ёмкость. Разберитесь, что происходит. Гибнут рыбы разных видов:\nУ разных родов и семейств различаются образ жизни, физиология и реакция иммунитета.\nВ первую очередь проверяют общие для них факторы: параметры воды, газовый режим, работу оборудования, возможное воздействие токсических веществ и кормление.\nГибнет один вид из нескольких\u0026hellip;массово и быстро.\nИщите причину в том, что могло объединять именно этот вид. Например, в кормлении: стайные рыбы могли первыми наброситься на корм и съесть его больше остальных.\nПоэтому объективно оценивайте результаты вскрытия нескольких рыб.\nПериодически умирают рыбы одного вида из нескольких.\nВ этом случае выше вероятность хронического инфекционного, паразитарного, алиментарного или иного процесса, к которому данный вид особенно чувствителен.\nНапример, при одинаковом кормлении у одного вида могут развиваться гепатоз или ожирение, тогда как для остальных рыб этот рацион окажется менее вредным.\nЕсли произошла гибель нескольких особей в одной ёмкости (массовый падёж): При массовом падеже исследуют сразу несколько рыб. Это позволяет определить, какие изменения повторяются, а какие встречаются только у отдельных особей. Жабры рыб, погибших примерно в одно время. Далеко не у всех особей обнаружены одинаковые изменения, поэтому единичную находку нельзя сразу объявлять причиной массового падежа. Вскрываем сразу несколько рыб для сравнения, чтобы исключить индивидуальные патологии. При массовом падеже желательно разделять погибших рыб по времени обнаружения и фиксировать это время: так можно сопоставить изменения у ранних и поздних случаев и точнее восстановить последовательность событий.\nПосмотреть препарат печени неона в виртуальном микроскопе\rАппетит рыбки — не показатель её здоровья У рыб очень сильные инстинкты. Даже если рыбка ест — это не значит, что с ней всё хорошо. Кишечник может оказаться нефункционирующим (гладкий, прозрачный, словно пакет с водой).\nРыба ест, но умирает от истощения: желудок и кишечник без следов пищи. Возможно, её тошнит после кормления — но этого уже никто не видит. Не полагайтесь на аппетит как на критерий здоровья.\nЕсли переносим рыб из «грязной» воды в чистую: Лечим рыб от бактериалки. Иначе велика вероятность, что заболевание проявится позже.\nЕсли рыба подвергалась воздействию Cryptocarion irritans: Периодически берём соскобы с тела и смывы с жабер (хотя бы раз в месяц).\nЖаберную форму на теле не видно… пока не будет поздно.\rCryptocaryon irritans. Паразит, а не просто белые точки\rНаучно обоснованный разбор биологии Cryptocaryon irritans: жизненный цикл, терминология tomont, theront, trophont, миф о «вездесущем …\rРыбу можно трогать и обрабатывать непосредственно Рыбу нельзя без необходимости травмировать. Но из этого не следует, что её нельзя фиксировать, осматривать и обрабатывать руками.\nКратковременная фиксация влажными руками в смотровых перчатках является обычной рабочей манипуляцией. Так можно взять соскоб, обработать рану, удалить некротизированную ткань, грибной налёт, наружного паразита или избыток патологически изменённой слизи.\nЕсли паразит или поражённый материал находятся на поверхности тела и доступны механически, их непосредственное удаление должно хотя бы рассматриваться. Даже неполная очистка способна за несколько минут значительно снизить нагрузку на рыбу.\nНе следует сохранять заражённую слизь, разрушающийся эпителий или некротизированную ткань только потому, что слизистый покров в норме выполняет защитную функцию. В конкретной ситуации этот материал уже может содержать множество паразитов, бактерий и тканевого детрита.\nЗапрет должен относиться не к прикосновению как таковому, а к неправильному прикосновению.\nЕсли наружного паразита можно удалить — удалите его Не обязательно ждать, пока препарат подействует через воду на всю паразитарную массу.\nИнфузорий, наружных червей, паразитических рачков, гифы на погибшей ткани и другие доступные объекты можно удалять промыванием, мягким протиранием, пинцетом или иным подходящим способом. Выбор метода зависит от вида рыбы, поверхности тела, расположения поражения и состояния животного.\nНевозможность удалить всех паразитов за одну процедуру не является основанием оставлять на рыбе всех паразитов.\nПрактический пример: механическое снижение паразитарной нагрузки при криптокарионозе\rКриптокарионоз: убиваем паразита или лечим воду?\rПрактический разбор лечения криптокарионоза у морских рыб: почему уничтожение паразита не должно становиться важнее состояния самой рыбы, …\rЕсли рыбка умирает во время нетравмирующих манипуляций (купание, пересадка): Возможно, при вскрытии вы обнаружите необратимые изменения, которые сами по себе могли привести к смерти.\nСтресс лишь спровоцировал гибель, которая в любом случае наступила бы в ближайшее время. Поэтому не спешите винить себя — проведите вскрытие и сделайте выводы. Вероятнее всего, рыбка уже была «не жилец».\nЕсли на поверхности тела гифы сапролегнии: Чаще всего оомицет закрепляется на участках некроза кожи или жабр.\nЕсли гифы выглядят как белый пух, то, скорее всего, это сапрофит — не причина, а следствие, просто индикатор.\nУ «хищных» оомицетов гифы стелются вдоль кожи. Налёт плотнее и напоминает мокрую вату: отдельные нити не видны.\nЕсли на рыбке гифы грибков: Лечите одновременно и бактериалку.\nВ «зарослях» грибков всегда живут бактерии, инфузории и жгутиконосцы.\nНе путайте бактерии и грибки — разница в размерах колоссальная.\nГифы грибков толще и внутри видна структура. Частые вопросы Если рыба ест — значит она здорова?\nНет. Аппетит не исключает серьёзных внутренних проблем.\nПочему гибнут сразу разные виды рыб?\nЧаще всего причина в воде, а не в инфекции.\nНужно ли сразу лечить при падеже?\nНет. Сначала нужно понять причину, иначе лечение может быть ошибочным.\nСколько рыб вскрывать при падеже?\nЖелательно несколько — это помогает отличить индивидуальную проблему от общей.\nСапролегния — это причина гибели?\nЧаще нет. Это вторичный организм, который растёт на уже повреждённых тканях.\n","permalink":"https://fossamethod.ru/ru/posts/rules/","summary":"\u003cbr style=\"clear: both\"\u003e\r\n\u003chr\u003e\n\u003cbr style=\"clear: both\"\u003e \r\n\u003ch3 id=\"если-в-аквариуме-по-непонятным-причинам-дохнет-рыба\"\u003eЕсли в аквариуме по непонятным причинам дохнет рыба:\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eПересадите всех рыб в другую ёмкость.\u003c/li\u003e\n\u003cli\u003eРазберитесь, что происходит.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003e\u003cstrong\u003eГибнут рыбы разных видов:\u003c/strong\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eУ разных родов и семейств различаются образ жизни, физиология и реакция иммунитета.\u003c/p\u003e\n\u003cp\u003eВ первую очередь проверяют общие для них факторы: параметры воды, газовый режим, работу оборудования, возможное воздействие токсических веществ и кормление.\u003c/p\u003e\u003c/blockquote\u003e\n\u003cp\u003e\u003cstrong\u003eГибнет один вид из нескольких\u0026hellip;массово и быстро.\u003c/strong\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eИщите причину в том, что могло объединять именно этот вид. Например, в кормлении: стайные рыбы могли первыми наброситься на корм и съесть его больше остальных.\u003c/p\u003e","title":"Простые правила при работе с аквариумной рыбой"},{"content":" Хирургические операции на гидробионтах под анестезией: щадящая техника и косметический шов. В хирургии рыб и других гидробионтов точность и щадящий подход имеют решающее значение, особенно если речь идёт о редких или ценных особях. Классические «матрасные» или грубые швы, часто применяемые на рыбзаводах, для таких случаев не подходят — они повышают риск осложнений, некроза и расхождения раны.\nОперация проводится на специальном столе, состоящем из двух частей: Основная коробка с водой и помпой обеспечивает постоянную подачу воды. Рабочий стол с вырезом — для фиксации рыбы в положении «на спине». Трубка от помпы вводится в рот рыбы, вода омывает жабры. Для предотвращения высыхания кожи рыба накрывается влажной тканью. В воду добавляется анестетик, что позволяет поддерживать животное в стабильном состоянии на протяжении всей операции. Дозировка гвоздичного масла - 0,35ml на 10 литров. К нему подобные рыбы очень чувствительны.\nАдобавляем анеастетик в воду Осматриваем Проводим операцию Особенности анатомии, которые влияют на выбор шва:\nКожа у большинства видов рыб плотная, по структуре напоминает сухожилие. Она легко отслаивается от мышечного слоя и при этом не срастается. Отслоившийся участок кожи быстро некротизируется. Мышцы имеют волокна, расположенные перпендикулярно ходу иглы, что делает их плохой опорой для грубых швов. Чтобы избежать некроза и обеспечить герметичность:\nПоверхностный кожный слой, склонный к некрозу, иссечён под углом. Косметический шов в плоскости раны: игла движется параллельно краю разреза, а не перпендикулярно коже. Нить не выходит наружу, а остаётся в толще ткани, стягивая именно мышечные края. Мышцы ушиваются в два слоя изогнутой иглой, что снижает риск попадания воды в рану и ускоряет заживление. При такой технике кожа затем зарастает новым слоем, а рубец становится почти незаметным. Извлекаем инородные тела Подготовка тканей и косметический шов Техника ушивания кишечника Разрез кишечника выполняется так, чтобы задеть минимальное количество сосудов. Кровотечение останавливается коагулятором.\nИнвагинирующий шов После извлечения инородных тел\u0026hellip;или, в общем, достижения цели\u0026hellip;накладывается простой шов «встык» для фиксации краёв. Затем выполняется внутренний инвагинирующий шов — края выворачиваются внутрь просвета кишки. Это важно, чтобы:\nне допустить слипания кишечника с другими органами; сохранить гладкую внутреннюю поверхность; обеспечить естественное переваривание лишних тканей, которые со временем резорбируются. Результат В случае с 40-сантиметровой калугой техника показала высокую эффективность:\nотсутствие некроза в зоне вмешательства; герметичность шва, исключающая попадание воды; минимальный рубец; уже через трое суток рыба питалась малыми порциями, без признаков осложнений. Через год Вывод Использование косметической техники ушивания и внутреннего шва на кишечнике в сочетании с анестезией позволяет проводить операции на гидробионтах максимально бережно. Это особенно важно, когда речь идёт не о массовом поголовье, а о ценных или единичных особях, где каждый шанс на успешное восстановление имеет значение.\nЛитература Harms C. Surgery in Fish Research: Common Procedures and Postoperative Care // Lab Anim. 2005. Т. 34. С. 28–34. Harms C. A., Lewbart G. A. Surgery in fish // Veterinary Clin. North Am. Exot. Anim. Pract. 2000. Т. 3. № 3. С. 759–774. Вопросы и ответы Можно ли оперировать рыбу? Да. При правильной технике и анестезии операции возможны и эффективны.\nЗачем подавать воду через рот? Для постоянного омывания жабр и поддержания дыхания во время операции.\nПочему обычные швы не подходят? Они повреждают ткани и повышают риск некроза и расхождения раны.\nЧто даёт косметический шов? Он минимизирует повреждение тканей и улучшает заживление.\nОпасна ли операция для рыбы? Риск есть, но при соблюдении техники он значительно снижается.\n","permalink":"https://fossamethod.ru/ru/posts/operation/","summary":"\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003chr\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003cbr style=\"clear: both\" \u003e \n\u003ch3 id=\"хирургические-операции-на-гидробионтах-под-анестезией-щадящая-техника-и-косметический-шов\"\u003eХирургические операции на гидробионтах под анестезией: щадящая техника и косметический шов.\u003c/h3\u003e\n\u003cbr style=\"clear: both\"\u003e\n\u003cp\u003eВ хирургии рыб и других гидробионтов точность и щадящий подход имеют решающее значение, особенно если речь идёт о редких или ценных особях.\nКлассические «матрасные» или грубые швы, часто применяемые на рыбзаводах, для таких случаев не подходят — они повышают риск осложнений, некроза и расхождения раны.\u003c/p\u003e\n\u003cbr style=\"clear: both\"\u003e\n\u003ccenter\u003e\n\r\n\r\n\r\n\r\n\u003ciframe src=\"/ru/post/Operation/HirTable.html\" width=\"100%\" height=\"400\" frameborder=\"1\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003c/center\u003e\n\u003cbr style=\"clear: both\"\u003e\n\u003ch3 id=\"операция-проводится-на-специальном-столе-состоящем-из-двух-частей\"\u003eОперация проводится на специальном столе, состоящем из двух частей:\u003c/h3\u003e\n\u003cbr style=\"clear: both\"\u003e\n\u003cul\u003e\n\u003cli\u003eОсновная коробка с водой и помпой обеспечивает постоянную подачу воды.\u003c/li\u003e\n\u003cli\u003eРабочий стол с вырезом — для фиксации рыбы в положении «на спине».\nТрубка от помпы вводится в рот рыбы, вода омывает жабры. Для предотвращения высыхания кожи рыба накрывается влажной тканью.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u003cem\u003eВ воду добавляется анестетик, что позволяет поддерживать животное в стабильном состоянии на протяжении всей операции.\u003c/em\u003e Дозировка гвоздичного масла - 0,35ml на 10 литров. К нему подобные рыбы очень чувствительны.\u003c/p\u003e","title":"Хирургические операции на гидробионтах"},{"content":"\nПереключить Миф / Реальность\rМиф \u0026ldquo;Смотреть можно только свежую рыбу\u0026rdquo; Рыбы, умершие в аквариуме, не подлежат вскрытию. Их необходимо препарировать немедленно, иначе никакой пользы от вскрытия не будет. При комнатной температуре рыбы разлагаются очень быстро: уже через несколько минут ткани и органы меняют цвет и структуру, а паразиты погибают или покидают хозяина.\nВ аквариуме из-за огромного количества бактерий процессы гниения начинаются мгновенно. Оценить состояние органов достоверно невозможно — цвет, консистенция и целостность будут искажены. На поверхности органов появятся бактерии, которые невозможно отличить от возбудителей заболевания. Паразиты покидают умирающего хозяина, а оставшиеся быстро погибают. Некоторые организмы, найденные на трупе, — это случайные сапрофиты, которых ошибочно принимают за причину болезни. В общем - если рыба полежала в аквариуме хотя бы непродолжительное время, вскрытие теряет смысл: ни патологии, ни паразитов определить нельзя.\nРеальность «Рыбы, умершие еще в аквариуме, вскрытию не подлежат!» Ваш браузер не поддерживает видео. Вскрытие рыбы Это заявление спорное. Даже в судебной медицине исследуют тела после значительного времени. Почему для рыб должно быть исключение? Исследования постмортальных изменений (патологоанатомия, криминалистика) показывают, что ценные диагностические признаки сохраняются часами и даже сутками при правильной интерпретации.\n«Через несколько минут ткани и органы изменяются» Да, изменения начинаются, но это не значит, что органы теряют информативность.\nВ медицине и ветеринарии учитывают стадии аутолиза, оценивают степень разложения и делают поправки при диагностике. У рыб обмен веществ быстрый, но при комнатной температуре заметная деградация занимает больше времени, чем «несколько минут». Практика и логика для этого и нужны\u0026hellip;(чтобы анализировать).\n«Паразиты погибают или покидают хозяина» — правда ли это? Куда, собственно, должны «уйти» паразиты? Жизненные циклы большинства паразитов аквариумных рыб предусматривают активное перемещение в пределах одной стадии. Они известны своей минимальной активностью: у гельминтов нет конечностей, глаз или каких-либо органов, позволяющих активно искать нового хозяина. Даже паразитические ракообразные, которые изначально ведут активный образ жизни, после попадания в организм меняют форму, становясь максимально пассивными — ведь их цель сводится к одному: выработке потомства.\nЕсли такая пассивная форма «покинет» хозяина, она окажется нежизнеспособной. Даже инфузории, вроде Cryptocaryon или Ichthyophthirius, физически не могут активно перемещаться если достигли крупного размера для деления: их реснички просто не справятся с массой тела. Да, у некоторых паразитов есть свободноплавающие стадии (например, у Monogenea — личинка-онкомирацидий). Но это относится только к стадии расселения. Взрослая форма, оснащённая крючьями для фиксации, теряет способность активно перемещаться (Buchmann and Lindenstrøm, 2002). Она не будет «ползать по дну» в поисках нового хозяина (Olstad et al., 2006). Если бы это было так, то все паразиты с дна находили бы камбал и других придонных рыб, что биологически нереально. Поэтому после гибели хозяина взрослая форма остаётся на теле до момента гибели, а затем подвергается бактериальному разложению.\nНа практике паразиты утрачивают подвижность только после гибели. И чаще всего она связана не с моментом смерти хозяина, а с ростом количества бактерий, которые начинают разрушать ткани. Сначала простейшие гибнут — их всё ещё можно идентифицировать по морфологии, особенно в мазках, отпечатках или окрашенных препаратах. Лишь позже, при полном разложении, они становятся неразличимыми (Tarannum et al., 2023).\nБактерии не «выходят» из кишечника мгновенно. Структура тканей препятствует этому (Brooks, 2016; Mesli et al., 2017). Если на внутренних органах изначально не было бактериальных колоний, они не появятся там просто так. Тем более посмертно не возникнут изменения, характерные для инфекций — язвы, гиперемия, гранулёмы.\nВажно понимать: рост бактериальной флоры не происходит мгновенно. Даже при температуре 22–27 °C разложение идёт медленнее, чем кажется.\n\u0026ldquo;Бактерии быстро всё съедают\u0026hellip;так как их очень много в аквариуме.\u0026rdquo; Тут стоит понять что мало и много - относительные понятия. Помните про отстаивание воды для подмены в аквариуме? Свежая вода мутнее чем вода в аквариуме. Почему?\nФакт: это физика, а не биология\rМутность свежей воды — микропузырьки газа, вышедшие из-за падения давления (в трубах давление выше атмосферного).\rЧерез 12–48 часов газы улетучиваются, вода становится прозрачной. Не потому, что «бактерии умерли», а потому, что пузырьков нет.\rДля реальной бактериальной вспышки нужны: органика (еда), время (часы–дни для размножения), условия (питательная среда). Чистая водопроводная вода обычно бедна органикой и бактериями, вспышка «из воздуха» невозможна.\nОткуда взялся ритуал «отстаивания»?\n-- Чтобы выровнять температуру.\r-- Чтобы ушли пузыри газа (вода была «красивой» и прозрачной).\r-- Люди объяснили это как «бактерии умерли → вода чистая».\r-- Так родился миф про «биобаланс при отстаивании».\rТак вот\u0026hellip; Если в аквариуме вода прозрачная и не вонючая - то и бактерий там не столько много как вам кажется. Вот когда там будет плавать много корма..или сдохнет пара рыб\u0026hellip;вот тагда, на основе этой органики произойдет та самая вспышка\u0026hellip;вода помутнеет\u0026hellip; Вот тогда будет МНОГО бактерий.\n«Некоторые „паразиты“ встречаются на умирающих рыбах и принимаются за причину смерти» Это верное замечание, но оно не повод избегать вскрытия — это повод повышать квалификацию. В криминалистике тоже есть «паразиты» в виде насекомых на трупах, но их не принимают за причину смерти при правильном подходе. Нужно учить интерпретировать находки, а не запрещать вскрытие. Не нужно путать «риск неправильной интерпретации» с «бессмысленностью исследования». Это разные вещи.\nReference Brooks, J.W., 2016. Postmortem Changes in Animal Carcasses and Estimation of the Postmortem Interval. Vet Pathol 53, 929–940. https://doi.org/10.1177/0300985816629720\nBuchmann, K., Lindenstrøm, T., 2002. Interaction between monogenean parasites and their fish host. International journal for parasitology 32, 309–19. https://doi.org/10.1016/S0020-7519(01)00332-0\nMesli, V., Neut, C., Hedouin, V., 2017. Postmortem bacterial translocation, in: Forensic Microbiology. pp. 192–211. https://doi.org/10.1002/9781119062585.ch8\nOlstad, K., Cable, J., Robertsen, G., Bakke, T.A., 2006. Unpredicted transmission strategy of Gyrodactylus salaris (Monogenea: Gyrodactylidae): survival and infectivity of parasites on dead hosts. Parasitology 133, 33–41. https://doi.org/10.1017/S0031182006009966\nTarannum, A., Rodríguez-Almonacid, C.C., Salazar-Bravo, J., Karamysheva, Z.N., 2023. Molecular Mechanisms of Persistence in Protozoan Parasites. Microorganisms 11, 2248. https://doi.org/10.3390/microorganisms11092248\nВопросы и ответы Можно ли вскрывать рыбу спустя несколько часов после смерти? Да, можно. Даже спустя несколько часов органы и ткани сохраняют диагностическую ценность. Важно учитывать степень посмертных изменений, а не отказываться от исследования полностью.\nЧто происходит с рыбой после смерти? Начинаются посмертные изменения (аутолиз), но они развиваются постепенно. Цвет и структура тканей меняются не мгновенно, и многие признаки остаются доступными для оценки.\nУходят ли паразиты после смерти рыбы? Нет. Большинство паразитов не покидают хозяина после его гибели. Они либо остаются на месте, либо постепенно разрушаются вместе с тканями.\nМожно ли перепутать бактерии с причиной болезни? Да, если не учитывать контекст. Бактерии могут появляться посмертно, но они не создают характерных патологических изменений «с нуля». Важно отличать причину от вторичных процессов.\nКогда вскрытие действительно теряет смысл? Когда ткани полностью разрушены и структура органов утрачена. Это происходит не через минуты, а значительно позже — в зависимости от температуры и условий.\n","permalink":"https://fossamethod.ru/ru/posts/freshfish/","summary":"Развенчиваем миф: почему вскрывать рыбу можно даже спустя несколько часов, а не только в первые 30 минут.","title":"Когда поздно для вскрытия?"},{"content":"\n\u0026ldquo;Петля восприятия\u0026rdquo; лекарственных средств: восторг → повсеместное применение → побочные эффекты → страх и отказ → разумный баланс. Давно пора переходить к последнему пункту\u0026hellip;\nПереключить Аверс / Реверс\rЛекарства как спасение Метиленовая синь Антисептик, детоксикант. Помогает при отравлениях, улучшает регенерацию тканей. Простое окрашивание для быстрой диагностики. Метиленовый синий — один из самых доступных и безопасных красителей в аквариумистике.\nОн действует как антисептик, помогает при отравлениях (например, нитритами), участвует в окислительно-восстановительных реакциях, улучшая снабжение тканей кислородом.\nПрименяется для профилактики грибковых инфекций икры, диагностики, и как мягкий бактерицид.\nНе требует сложных условий хранения, легко дозируется, подходит даже для мальков и слабых рыб при кратковременных купаниях.\nФормалин Один из немногих средств против Cryptocaryon irritans, Ichthyophthirius и других инфузорий. Убивает паразитов на ранней стадии. Входит в состав протоколов карантина во многих зоопарках и институтах. Формалин (раствор формальдегида) давно применяется в зоологии и аквариумистике.\nЭффективен против паразитических инфузорий, моногеней, грибков.\nМожно использовать как купание, ванну или точечную обработку.\nХорошо проникает в слизь, разрушая цисты паразитов.\nСовместим с малахиткой и метиленкой — основа классического FMC.\nМалахитовый зелёный Быстро устраняет грибки и простейших. Незаменим в условиях экстренной угрозы. Малахитка (малахитовый зелёный оксалат) — одно из самых сильных противогрибковых и антипаразитарных средств.\nОсобенно эффективна против Ichthyophthirius, Saprolegnia, Trichodina и других поверхностных паразитов.\nДаёт быстрый результат, может применяться в купаниях, пролонгированных ваннах и даже системно в низких дозах.\nЧасто входит в состав проверенных смесей вроде FMC (формалин-малахит-метиленка).\nФМС (FMC) Раньше — это была спасительная формула: три компонента, каждый «бьёт» по разным направлениям. Смешивать в одну ванну — удобно, дёшево, даёт визуальный эффект (успокоение, улучшение внешнего вида, снятие слизи). Работает при ранних стадиях и на неустойчивых паразитов (Trichodina, лёгкая форма Ichthyophthirius и др.). Изначально считался почти универсальным решением, распространился по инерции, стал «ритуалом» в аквариумистике. Антибиотики Позволяют локализовать сепсис. Спасают в случаях, когда альтернатив нет (например, при аэромонозах, стафилококковых поражениях жабр). Современные антибиотики (окситетрациклин, эритромицин, нитрофураны и др.) позволяют бороться с системными инфекциями: сепсис, аэромоноз, псевдомонадоз, микобактериоз.\nОни эффективны даже при тяжёлых поражениях тканей.\nБез них смертность в заражённых аквариумах часто достигает 100%.\nПри правильной диагностике и контроле состояния воды антибиотикотерапия может спасти популяции.\nЛекарства как скрытая угроза Метиленовая синь Окислитель, влияет на ферментативные процессы. Может быть нефротоксична при хроническом использовании. Маскирует проблемы, не устраняя первопричину. При систематическом применении метиленовый синий может окрашивать ткани, нарушать работу печени, вызывать раздражение жабр.\nОн способен угнетать микрофлору аквариума, особенно при длительном использовании.\nВлияние на мальков при высоких концентрациях не всегда благоприятное.\nКроме того, он не действует на большинство серьёзных патогенов — но создаёт иллюзию лечения, отодвигая диагностику и настоящую помощь.\nФормалин Токсичен, канцерогенен. Повреждает жабры, почки, печень. Вредит ослабленным рыбам. Особенно опасен в старых системах с плохой аэрацией. Индуцирует мутации у паразитов — формалин-резистентность. Формальдегид — это сильный мутаген, канцероген и общетоксичное соединение. Он разрушает слизистую, вызывает ожоги жабр и кожи.\nУ рыб с гепатозом и поражениями внутренних органов может вызвать быстрый отказ систем.\nОсобенно опасен при недостаточной аэрации: связывает кислород, вызывая гипоксию.\nУдушье, стресс и интоксикация — типичные последствия необоснованного купания в формалине.\nМалахитовый зелёный Запрещён во многих странах (например, в ЕС) из-за канцерогенности. Может вызывать стресс-реакцию, ослабляя иммунитет. Это токсичный трифенилметановый краситель, способный повредить жабры, кожу, печень.\nМожет вызывать стресс, особенно у рыб с уже ослабленным метаболизмом, при гепатозе, почечной недостаточности.\nПри передозировке возможна смерть.\nТакже остаётся в тканях рыб, что делает его неприемлемым в пищевой промышленности и спорным в общественных аквариумах.\nУ некоторых рыб (сомики, лорикарии, араваны) малахит особенно опасен.\nFMC (формалин + малахитовый зелёный + метиленовый синий) Зачастую малоэффективен, особенно при неправильной дозировке и кратковременных ваннах. Кратковременное воздействие (5–15 мин) часто не успевает уничтожить паразита, особенно тех, кто глубже — в жабрах или под эпителием. Формалин в такой концентрации небезопасен для ослабленных рыб, а малахитка усиливает токсичность. Устойчивость патогенов + снижение чувствительности слизи = эффект ритуала: вроде делаем, но паразиты возвращаются. Многие просто не контролируют температуру, аэрацию, pH, что ещё больше снижает эффективность и повышает риск. Отвлекает от диагностики и системного подхода, создавая ощущение «лечения по наитию». Смесь долгое время считалась универсальной палочкой-выручалочкой. Кратковременные ванны по 5–15 минут применялись почти при любом подозрении на паразитов. Однако на практике это лечение всё чаще становится ритуалом — без анализа, без диагностики, без результата.\nМетиленовый синий из состава убивает нитрифицирующие бактерии, что особенно заметно в устойчиво запущенных системах: вода быстро портится, особенно при добавлении в общий объём.\nФормалин — токсичен для печени и почек. При кратком купании не убивает паразитов, особенно жаберных или глубоко сидящих, зато ослабляет рыбу.\nМалахитка вносит свой вклад в общую токсичность, усиливая раздражение слизистых и жабр.\nЕсли паразиты выжили, а рыба стала слабее — это не лечение, это ошибка. А ещё — это откат к устаревшей традиции, когда «всех лечили одинаково», не вникая в природу проблемы. Так формируется ложная уверенность, что что-то было сделано, хотя на деле — лишь потеря времени и ухудшение состояния животных. А форма коротких ванн часто оказывается не лечением, а обрядом — красивым, но бесполезным.\nАнтибиотики Приводят к устойчивости флоры (например, Aeromonas hydrophila, Pseudomonas spp.). Уничтожают микробиом кишечника. После “успешного лечения” возможен рецидив — уже с устойчивыми штаммами. Оставшиеся в воде остатки — угроза всей системе. При применении \u0026ldquo;на глаз\u0026rdquo;, без посева и антибиотикограммы, антибиотики почти всегда неэффективны или вредны.\nОни подавляют нормальную микрофлору, вызывают дисбактериоз, способствуют развитию устойчивых штаммов.\nНекоторые патогены начинают мутировать и возвращаться в ещё более агрессивной форме.\nПосле курса антибиотиков рыбы часто погибают от других, вторичных инфекций.\nА в рециркуляционных системах остатки препаратов годами нарушают микробный баланс.\nПочему такие практики живут десятилетиями? Потому что не ведётся корректный учёт лечения. Если не зафиксированы параметры, не сохранены мазки, не записана дозировка, длительность, исход — нельзя отличить полезное вмешательство от вредного. Чтобы искоренить такие \u0026quot;обряды\u0026quot;, нужны рабочие журналы и цифровая база лечения — с возможностью анализировать данные, выявлять неэффективные подходы и адаптировать терапию к конкретной ситуации.\nЛитература Bly J. и др. Therapeutic and prophylactic measures for winter saprolegniosis in channel catfish // Dis. Aquat. Organ. 1996. Т. 24. С. 25–33. Campbell R. E. и др. In vitro screening of novel treatments for Aphanomyces invadans // Aquac. Res. 2001. Т. 32. № 3. С. 223–233. Culp S. J., Beland F. A. Malachite Green: A Toxicological Review // J. Am. Coll. Toxicol. 1996. Т. 15. № 3. С. 219–238. Lindholm‐Lehto P., Pylkkö P. Saprolegniosis in aquaculture and how to control it? // Aquac. Fish Fish. 2024. Т. 4. Mooney A. Malachite Green found in Shrimp exports from Bangladesh [Электронный ресурс]. URL: https://mta-sts.randoxfood.com/malachite-green-found-in-shrimp-exports-from-bangladesh/ (дата обращения: 04.07.2025). Rao V., Ajith Kumar T. T., Badhul H. Diseases in the Aquarium Fishes: Challenges and areas of concern. // Int. J. Environ. 2013. Т. 2. Saglam N., Ispir U., Yonar M. The Effect of Therapeutic Bath of Malachite Green on Some Haematological Parameters of Rainbow trout (Oncorhynchus mykiss, Walbaum, 1792) // Fresenius Environ. Bull. 2003. Srivastav A. Malachite green (Triarylmethane dye) and Pyceze (Bronopol) induced histopathological and biochemical changes in the liver of a catfish Heteropneustes fossilis (Bloch.) // Indian J. Fish. 2016. Т. 63. С. 135–139. Srivastava S., Sinha R., Roy D. Toxicological effects of malachite green // Aquat. Toxicol. Amst. Neth. 2004. Т. 66. № 3. С. 319–329. Sudova E. и др. Negative effects of malachite green and possibilities of its replacement in the treatment of fish eggs and fish: a review // Veterinární Medicína. 2007. Т. 52. № 12. С. 527–539. Transcriptome analysis of zebra fish (Danio rerio) eggs following treatment with malachite green // Aquaculture. 2020. Т. 514. С. 734500. Частые вопросы Можно ли лечить рыбу сразу несколькими препаратами?\nМожно, но это увеличивает нагрузку на организм и систему. Без понимания — риск.\nЕсли препарат помог один раз — значит он универсальный?\nНет. Эффект зависит от причины болезни, а не от “силы” препарата.\nПочему рыбе стало хуже после лечения?\nЛекарства сами по себе токсичны и могут усугубить состояние ослабленной рыбы.\nФормалин и малахитка — это безопасно?\nНет. Это эффективные, но потенциально опасные вещества с выраженной токсичностью.\nМожно ли лечить без диагностики?\nМожно, но это уже не лечение, а попытка угадать.\n","permalink":"https://fossamethod.ru/ru/posts/medicines_poisons/","summary":"\u003cbr\u003e\r\n\u003cblockquote\u003e\n\u003cblockquote\u003e\n\u003cp\u003e\u0026ldquo;Петля восприятия\u0026rdquo; лекарственных средств:\nвосторг → повсеместное применение → побочные эффекты → страх и отказ → \u003ccode\u003eразумный баланс\u003c/code\u003e. Давно пора переходить к последнему пункту\u0026hellip;\u003c/p\u003e\u003c/blockquote\u003e\u003c/blockquote\u003e\n\u003cbr\u003e\r\n\r\n\r\n  \r\n  \r\n  \r\n  \r\n\r\n  \r\n  \r\n  \r\n    \r\n    \r\n  \r\n\r\n  \r\n\r\n  \u003cdiv id=\"Medicines\" class=\"toggleblock avers-revers\"\u003e\r\n    \u003cbutton class=\"toggle-btn\" onclick=\"toggleBlock('Medicines')\"\u003eПереключить Аверс / Реверс\u003c/button\u003e\r\n    \u003cdiv class=\"toggle-content first\"\u003e\u003ch2 id=\"лекарства-как-спасение\"\u003eЛекарства как спасение\u003c/h2\u003e\n\u003cbr\u003e\r\n\u003cul\u003e\n\u003cli\u003e\n\u003ch3 id=\"метиленовая-синь\"\u003eМетиленовая синь\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eАнтисептик, детоксикант.\u003c/li\u003e\n\u003cli\u003eПомогает при отравлениях, улучшает регенерацию тканей.\u003c/li\u003e\n\u003cli\u003eПростое окрашивание для быстрой диагностики.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eМетиленовый синий — один из самых доступных и безопасных красителей в аквариумистике.\u003cbr\u003e\nОн действует как антисептик, помогает при отравлениях (например, нитритами), участвует в окислительно-восстановительных реакциях, улучшая снабжение тканей кислородом.\u003cbr\u003e\nПрименяется для профилактики грибковых инфекций икры, диагностики, и как мягкий бактерицид.\u003cbr\u003e\nНе требует сложных условий хранения, легко дозируется, подходит даже для мальков и слабых рыб при кратковременных купаниях.\u003c/p\u003e","title":"Две стороны одной дозировки"},{"content":" Допустим, вас зовут Лена…\nну или Таня…\nну или Саня…\nГлавное — у вас есть желание постигать разумный подход к содержанию гидробионтов в океанариуме, в котором вы работаете.\nЕсть микроскоп.\nЕсть люди, на которых не надо равняться — для контраста они тоже нужны.\nВы даже обзавелись красителями?\nТогда начнём.\n1. Распаковка Рыбка ехала в пакетах — мало воды, много воздуха.\nПуть проделала долгий. Перед отправкой не кормили.\nАккуратно проводим покровным стеклом. Приложили к ране, придавили, убрали. Мазок-отпечаток. Вот это — множество бактерий. Малое количество воды быстро портится.\nФекалии будут присутствовать в воде — с высокой долей вероятности.\nВ таких условиях вода не может становиться лучше — она будет только портиться. Такая вот энтропия.\nРастёт концентрация токсичных продуктов обмена, а к этому добавляется бактериальный рост.\nКакое именно количество бактерий и каких — покажет время…\nну, или мазок.\nЕсли при распаковке делать мазки, мазки-отпечатки и соскобы с поверхности тела рыб, то уже в первый час можно оценить их состояние и составить план дальнейших действий.\nЕсть простое и удобное окрашивание методом Леффлера: Насыщенный спиртовой раствор метиленовой сини:\n1,6 г метиленового синего растворяют в 100 мл 95%-го этилового спирта. 30 мл насыщенного спиртового раствора смешивают со 100 мл 0,01%-го раствора КОН. Раствор КОН: 0,01 г КОН на 99,99 мл дистиллированной воды. Итог на 100 мл:\nметиленовая синь — 0,37 г;\n95% этанол — 23,08 мл;\n0,01% КОН — 76,92 мл. Подходит для окрашивания тканей, бактерий, грибков.\n10–30 секунд — и картина уже читается.\nЕсли бактерии в мазке — «разнокалиберный зоопарк» Ещё словечки для описания \u0026ldquo;полимикробный конгломерат\u0026rdquo;,\n\u0026ldquo;полиморфная бактериальная ассоциация\u0026rdquo;,\n\u0026ldquo;гетерогенное скопление бактерий\u0026rdquo;,\n\u0026ldquo;плеоморфный бактериальный массив\u0026rdquo;,\n\u0026ldquo;разноконтурный бактериальный агрегат\u0026rdquo;,\n\u0026ldquo;смешанное бактериальное сообщество\u0026rdquo;,\n\u0026ldquo;разнородный бактериальный консорциум\u0026rdquo;,\n\u0026ldquo;поликультура бактерий\u0026rdquo;.\nРазличные бактерии в одном поле зрения. «Когда под микроскопом видишь “бактериальную помойку” — это чаще всего просто грязь после перевозки.\nЭто не инфекция, а хаос. Но именно в таком хаосе могут скрываться опасные формы.»\nЕсли бактерии все одинаковые — «стройные ряды угрозы» Множество одинаковых бактерий. «Мономорфная картина — тревожный признак.\nОдна форма вытеснила остальные. Такое часто указывает на инфекционный процесс.»\nВ таком случае имеет смысл посев → антибиотикограмма → лечение.\nТакже обращаем внимание на язвы.\nВ них иногда обнаруживаются микобактерии (возбудители туберкулёза рыб).\nПростым окрашиванием микобактерии не выявляются. Масштаб 20 μm. Про микобактерии и окрашивание Микобактерии отличаются кислотоустойчивостью — их клеточная стенка богата липидами и миколовыми кислотами.\nИз-за этого они не выявляются обычными водорастворимыми красителями.\nПоэтому используют окрашивание по принципу Циля–Нильсена:\nне как ритуал с конкретными реагентами, а как биологический приём —\nкраситель проникает в оболочку, а затем не вымывается кислотой.\nВажно понимать:\nкритичен принцип, а не конкретная кислота или фенол.\nВ практике можно обходиться:\nконцентрированным фуксином; нагревом (для ускорения проникновения); мягкой кислотой (в т.ч. лимонной) — при достаточной экспозиции. Классический принцип окрашивания (адаптируемый) Препарат высушивают и фиксируют.\nНаносят фуксин, слегка подогревают до появления паров.\nПосле охлаждения проводят кислотную обработку (до обесцвечивания фона).\nДокрашивают метиленовой синью.\nКислотоустойчивые бактерии остаются красными, остальные — синими.\nКислотоустойчивые бактерии сохраняют окраску. Кислотоустойчивость — не «магия метода», а свойство оболочки бактерий.\n2. Токсикоз В транспортировке рыба часто травится.\nМетиленовый синий может быть полезен, но:\nтолько в малых дозах; как поддержка, а не «лечение всего». Идеальных препаратов не существует.\n3. Карантин Если нет явной катастрофы —\nрыбам нужно время восстановиться.\nКороткие купания «на всякий случай» часто вреднее бездействия.\nНапоследок Всех этих «козявок» можно найти в Галерее. А здесь — презентация по паразитам.\nИ да — не путайте бактерии и грибки.\nРазмеры у них, как правило, разные на порядок.\nГифы грибков толще, внутри видна структура. Вопросы и ответы Нужно ли сразу лечить рыбу после перевозки? Нет. Сначала нужно оценить её состояние.\nПочему в мазке много разных бактерий? Это чаще следствие транспортировки, а не инфекции.\nКогда бактерии — это опасно? Когда наблюдается мономорфная картина.\nНужно ли сразу делать посев? Только если есть признаки инфекции.\nЗачем вообще брать мазки? Чтобы сразу понять, с чем имеешь дело.\n","permalink":"https://fossamethod.ru/ru/posts/coming/","summary":"\u003cstyle\u003e\ndetails \u003e summary {\n    padding: 5px;\n    background-color: #7A949BFF;\n    color: #333;\n    border: 1px #FFFFFFFF solid;\n    cursor: pointer;\n    list-style: none;\n    font-weight: bold;\n}\ndetails \u003e div {\n    border: 1px #ccc solid;\n    padding: 10px;\n}\ndetails[open] \u003e summary {\n    color:#eee;\n    background-color:#333;\n}\nsummary:before {\n    content: \"+\";\n    font-size: 20px;\n    font-weight: bold;\n    margin: -5px 5px 0 0;\n}\ndetails[open] summary:before {\n    content: \"-\";\n}\n\u003c/style\u003e\n\u003cbr\u003e\n\u003cp\u003eДопустим, вас зовут Лена…\u003cbr\u003e\nну или Таня…\u003cbr\u003e\nну или Саня…\u003c/p\u003e\n\u003cp\u003eГлавное — у вас есть желание постигать \u003cstrong\u003eразумный подход\u003c/strong\u003e к содержанию гидробионтов в океанариуме, в котором вы работаете.\u003cbr\u003e\nЕсть микроскоп.\u003cbr\u003e\nЕсть люди, на которых не надо равняться — для контраста они тоже нужны.\u003c/p\u003e","title":"Что делать с рыбой после приезда"},{"content":"\rПереключить Миф / Реальность\rЗаблуждение В большинстве случаев причиной болезни является перенасыщение воды азотом, реже кислородом. Перенасыщение происходит в результате ее подогрева в закрытых емкостях, где нет свободного выхода газов, как, например, в теплообменниках тепловых и атомных электростанций, в бойлерах инкубационных цехов. - Пузырьки воздуха в воде, на стекле и растениях опасны — они закупоривают жабры рыб и вызывают гибель. - Внешние признаки газовой эмболии появляются через несколько часов после того, как рыба попадает в перенасыщенную газами воду. Чем выше процент насыщения воды газами, тем скорее появляются эти признаки и рыба погибает. Если процент насыщения меньше, рыба живет дольше и внешние признаки (расположение пузырьков) более разнообразны. - При вскрытии относительно крупных рыб из кровеносных сосудов, выступает пенистая кровь., Возбужденное поведение, Обостренная чувствительность к механическим раздражителям, Потеря равновесия, Судорожное дрожание плавников, Ерошение чешуи, Отделение планиковых лучей, Помутнение роговицы, Посветление окраски, Потемнение окраски, Потеря зрения, Пучеглазие. - Причины: активное выделение растениями кислорода и одновременно неумеренная искусственная аэрация, а также использование неотстоянной водопроводной воды. Заболевание развивается в условиях избытка кислорода и азота в воде. Кислород, в избытке поступая в кровеносную систему рыбы, скапливается в виде мелких пузырьков и вызывает закупорку сосудов. Попадая, в капилляры (тончайшие кровеносные сосуды), пузырьки кислорода по размерам оказываются больше диаметра этих сосудов. Происходит их закупорка, так как сила сердечного толчка недостаточна для проталкивания газа по капиллярам. - Диагноз ставят на основании клинической картины, патологоанатомических изменений, которые находят при вскрытии рыб, и результатов исследования воды на содержание в ней растворимого кислорода. fishy.ru\nakvakultura.ru\ncnshb.ru\nНаучный подход При повышении давления пузырьки не образуются. Молекулы газа остаются растворёнными, смешиваясь с молекулами воды. Газопузырьковая болезнь (ГПБ) — это заболевание, при котором в крови и тканях рыбы образуются свободные газовые пузыри. Они нарушают кровообращение, повреждают жабры и внутренние органы, вызывают ишемию тканей и могут приводить к гибели животного.\nНа первый взгляд причина кажется очевидной: в воде есть пузырьки воздуха, значит именно они и попадают в организм рыбы. Именно так газопузырьковую болезнь объясняют во многих статьях, книгах и даже учебных пособиях.\nОднако это объяснение ошибочно.\nГазопузырьковая болезнь развивается не потому, что рыба соприкасается с пузырьками воздуха, а потому, что вода содержит избыточное количество растворённых газов. Это принципиально разные явления. Пузырьки, которые мы видим в аквариуме, и пузыри, возникающие в сосудах рыбы, имеют совершенно разное происхождение.\nЧто вызывает газопузырьковую болезнь? Причиной заболевания является газовая сверхнасыщенность воды (gas supersaturation).\nПри определённых условиях вода способна растворять больше газов, чем соответствует равновесию при данном давлении и температуре. Чаще всего речь идёт об азоте, реже — о кислороде или смеси различных атмосферных газов.\nПока давление остаётся повышенным, избыток газа может полностью находиться в растворённом состоянии. Вода выглядит абсолютно прозрачной, хотя фактически содержит больше газа, чем должна удерживать в равновесии.\nИменно такая вода представляет опасность.\nЕсли вода содержит избыток растворённых газов, их парциальное давление у поверхности жабр становится выше, чем в крови. Возникает градиент, и газы начинают диффундировать через жаберный эпителий до тех пор, пока не установится новое равновесие.\nИменно так развивается газопузырьковая болезнь.\nГде появляются пузыри? Вытянутые газовые пузыри в сосудах плавника рыбы. Характерная форма указывает на их образование внутри кровотока под давлением. Это один из самых важных вопросов. Газовые пузыри не попадают в организм рыбы из окружающей воды.\nОни возникают внутри организма, когда растворённый газ перестаёт удерживаться в крови и тканевой жидкости.\nПоэтому обнаружение пузырей в сосудах вовсе не означает, что они проникли через жабры. Они сформировались там, где возникли условия для выхода растворённого газа из раствора.\nТакой механизм хорошо известен не только в ихтиопатологии. По тем же физическим законам развивается декомпрессионная болезнь у водолазов.\nПочему пузырьков может вообще не быть? Именно здесь возникает главное заблуждение. Большинство людей оценивает риск по тому, сколько пузырьков видно в воде. На самом деле всё может быть наоборот.\nПри повышенном давлении вода способна удерживать большое количество газа без образования пузырьков. Газ полностью растворён и остаётся невидимым.\nКогда давление снижается, растворимость уменьшается, и избыток газа начинает выходить из воды в виде пузырьков.\nИначе говоря, видимые пузырьки часто свидетельствуют не о появлении проблемы, а о том, что вода уже начинает освобождаться от избытка растворённого газа.\nДавление удерживает газ растворённым Ваш браузер не поддерживает видео. Давление влияет на растворимость. Этот процесс описывается законом Генри:\nКоличество газа, которое может удерживать вода, определяется его парциальным давлением.\nC = kH × P\nгде:\nC — концентрация растворённого газа; kH — коэффициент Генри; P — парциальное давление газа.\nИз этого закона следует простой вывод.\nЕсли увеличить давление, вода сможет растворить больше газа.\nЕсли затем давление уменьшится, растворимость снизится, а избыток газа начнёт покидать раствор.\nИменно поэтому повышение давления в элементах системы водоподготовки может создавать условия для формирования газовой сверхнасыщенности, тогда как сами пузырьки часто появляются уже после снижения давления.\nПочему важно это понимать? Профилактика невозможна, если ориентироваться только на пузырьки. Правильные меры включают:\nконтроль давления в водоподготовке; мониторинг TGP (если возможно); аэрацию и каскадные барботеры — для удаления избыточного газа; При вскрытии Наличие газа в тканях при вскрытии само по себе не является доказательством ГПЗ. Посмертное образование пузырей — обычное явление при нагревании трупа и автолизе. При повышении температуры растворимость газов падает, и они выходят из раствора, формируя скопления в сосудах и под серозными оболочками. Таким образом, наличие газа при вскрытии отражает не только процессы, происходившие при жизни, но и изменения, возникшие после гибели.\nПрактический факт По нашим наблюдениям обычные аквариумные насосы сами по себе редко создают уровень газовой сверхнасыщенности, достаточный для развития классической газопузырьковой болезни. Даже при подсосе воздуха и повышении давления примерно до 0,5 бар сверх атмосферного увеличение растворимости газов оказывается ограниченным и обычно не сопровождается характерными признаками заболевания.\nРиск возникает тогда, когда одновременно присутствуют несколько факторов:\nподсос воздуха в напорную линию; накопление газа под повышенным давлением; последующее быстрое снижение давления. Именно сочетание этих условий способно привести к опасной газовой сверхнасыщенности.\nВывод Газопузырьковая болезнь развивается не потому, что пузырьки попадают в организм рыбы. Она развивается потому, что вода содержит избыток растворённых газов.\nПузырьки, которые мы видим в аквариуме, чаще являются следствием дегазации, а не причиной заболевания. Поэтому при диагностике важно искать не пузырьки, а условия, при которых возникает газовая сверхнасыщенность.\nЛитература Legendre D., Zenit R. Gas bubble dynamics // 2025. Chen X. и др. An in-situ study in the Xijiang River basin revealed adverse effects of total dissolved gas supersaturation on fish // Ecotoxicol. Environ. Saf. 2025. Т. 289. С. 117663. Hong W. H. и др. Gas bubble disease in captive Golden Trevally: Pathological insights and needs for life support system and water quality management // J. Aquat. Anim. Health. 2024. Т. 36. № 4. С. 348–354. Máchová J. и др. Fish death caused by gas bubble disease: A case report // Veterinární Medicína. 2017. Т. 62. С. 231–237. Pleizier N. K., Brauner C. J. Causes and consequences of gas bubble trauma on fish gill function // J. Comp. Physiol. B. 2024. Т. 194. № 5. С. 739–747. Wang H. и др. Tolerance threshold of a pelagic species in China to total dissolved gas supersaturation: from the perspective of survival characteristics and swimming ability // Conserv. Physiol. 2024. Т. 12. № 1. С. coae023. Causes and consequences of gas bubble trauma on fish gill function - PubMed [Электронный ресурс]. URL: https://pubmed.ncbi.nlm.nih.gov/38453727/ (дата обращения: 24.02.2025). Часть II. Последствия.\rГазопузырьковая болезнь. Часть II. Последствия.\rСравнение нормы и патологии при вскрытии рыб: печень, почки, жабры и головной мозг. Как отличать допустимые варианты от признаков застоя, …\rВопросы и ответы Пузырьки в воде — это опасно? Не обязательно. Видимые пузырьки часто означают, что газ уже выходит из воды.\nПочему тогда рыба гибнет? Из-за растворённых газов, а не пузырьков как таковых.\nМогут ли пузырьки попасть в кровь из воды? Нет. Они формируются внутри организма.\nМожно ли увидеть проблему без приборов? Не всегда. Перенасыщение может быть невидимым.\nХолодная вода вызывает болезнь? Нет. Важен не холод, а газовая сверхнасыщенность.\n","permalink":"https://fossamethod.ru/ru/posts/bublle/","summary":"Газопузырьковая болезнь у рыб — не результат попадания пузырьков в жабры, а следствие перенасыщения воды растворёнными газами. В статье объясняются реальные механизмы болезни, типичные заблуждения и меры профилактики.","title":"Газопузырьковая болезнь. Не в пузырьках дело..."},{"content":" Представим ситуацию. В аквариум поступает рыба с подозрением на бактериальную инфекцию. Наружные признаки есть: язвочка, немного слизи, покраснение. Что делает лаборант? Часто — берёт пробу, ставит бакпосев, а результат будет через 3–5 дней. Все ждут. А рыба — болеет сейчас. На первый взгляд, всё правильно: посев покажет, кто виноват, и на что чувствителен. Но вот только время идёт, инфекция развивается, а антибиотик, возможно, был не тот. Или хуже — рыбу уже начали лечить до взятия пробы, и ничего в посеве не вырастет. И все разводят руками: «Не выросло ничего…». Ищут вирусы, плавают в догадках. Хотя решение было ближе, чем казалось. Что можно было сделать сразу?\nВзять мазок-отпечаток с поверхности поражения, окрасить и посмотреть в микроскоп. В течение 10–15 минут можно было бы:\nУвидеть бактерии — их форму, расположение, агрегацию;\nОценить воспалительную реакцию (нейтрофилы, макрофаги, некроз);\nЗаподозрить грибок или даже паразита (да-да, слизь — не всегда бактерии).\nТакой подход даёт возможность сразу понять: это бактериальный процесс? Острый? Есть признаки инвазии? Нужно ли срочно менять терапию или вообще думать в другом направлении? Почему микроскопия важнее, чем её принято считать?\nОна даёт результат сразу — здесь и сейчас. Не надо ждать.\nНе зависит от жизнеспособности возбудителя. Даже убитые антибиотиком микробы можно увидеть.\nПоказывает тканевую реакцию, которую не даст ни один посев.\nЭкономичнее и доступнее: нужна только окраска и микроскоп.\nПомогает не лечить \u0026ldquo;вслепую\u0026rdquo;, а принимать обоснованные решения.\nА как же посев? Посев — важен. Но он следующий шаг. Он нужен, когда хочется знать точно: кто это и чем его бить. Но он работает хорошо только в идеальных условиях: стерильно взятая проба, отсутствие антибиотиков, подходящая среда, правильная температура и время. А главное — если возбудитель вообще способен к росту. Пример из практики\nПримеры из практики: Однажды была рыба с классическими \u0026ldquo;бактериальными\u0026rdquo; язвами. Посев — ноль. Ни одной колонии. Мазок с окраской показал диплококки в большом количестве. Оказалось, рыбу лечили три дня до забора пробы. Всё погибло, но бактерии остались в ткани. И этот мазок буквально спас ситуацию: по форме и локализации возбудителя подобрали препарат, и он сработал.\nА бывает и так... Иногда всё кажется спокойно: вскрытие прошло без сюрпризов, органы — чистые, воспалений нет, ткань не реагирует. Ни в мазках, ни в отпечатках — ничего подозрительного. И ты уже начинаешь склоняться к непаразитарным причинам: может, стресс, газовая проблема, или что-то системное, неинфекционное.\nНо тут — появляется посев. Из глубин тканей, где, казалось бы, нет ни малейшего намёка на инфекцию, вдруг вырастают несколько колоний. И не просто бактерии, а представители «опасных» групп. Вроде бы и немного — десяток штучек, но эффект мгновенный: диагноз поставлен, виновник найден, начинаются разговоры про патогенную флору.\nТолько вот вопрос — если бактерии были такими опасными, почему их не видно в микроскоп, почему ткани молчат, и почему смерть наступила без борьбы? Без воспаления, без классической картины сепсиса или локальной реакции. Как они там жили? Где их след?\nА главное — многие верят лабораторному листку, даже если сам процесс болезни противоречит всему, что в нём написано. Так работает эффект «волшебной чашки Петри»: вырастить — значит доказать. А то, что эта культура могла быть случайной, контаминированной, или просто малозначимой — остаётся за кадром. Потому что бактерии есть. А значит, виновны.`\nВывод Микроскопия мазка — это не просто старая школьная техника. Это глаза патолога, ихтиолога, ветеринара. Это способ не терять время и не пускать болезнь на самотёк. Посев — уточнение. А первый ответ — в мазке.\nЧастые вопросы Почему не дождаться результата посева?\nПотому что рыба болеет сейчас. Микроскопия даёт ответ сразу.\nЕсли в посеве ничего не выросло — значит инфекции нет?\nНет. Возбудитель мог погибнуть или не расти в условиях посева.\nМожно ли поставить диагноз только по мазку?\nИногда да. Мазок показывает структуру процесса и тип поражения.\nЗачем тогда нужен посев?\nДля уточнения возбудителя и подбора антибиотика.\nЧто важнее — мазок или посев?\nЭто не конкуренты. Мазок — быстрый этап, посев — уточняющий.\n","permalink":"https://fossamethod.ru/ru/posts/smear/","summary":"\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003chr\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003ch3 id=\"представим-ситуацию\"\u003eПредставим ситуацию.\u003c/h3\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003cpre\u003e\u003ccode\u003eВ аквариум поступает рыба с подозрением на бактериальную инфекцию. Наружные признаки есть: язвочка, немного слизи, покраснение. Что делает лаборант? Часто — берёт пробу, ставит бакпосев, а результат будет через 3–5 дней. Все ждут. А рыба — болеет сейчас. \n\u003c/code\u003e\u003c/pre\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eНа первый взгляд, всё правильно: посев покажет, кто виноват, и на что чувствителен. Но вот только время идёт, инфекция развивается, а антибиотик, возможно, был не тот. Или хуже — рыбу уже начали лечить до взятия пробы, и ничего в посеве не вырастет. И все разводят руками: «Не выросло ничего…». Ищут вирусы, плавают в догадках. Хотя решение было ближе, чем казалось.\nЧто можно было сделать сразу?\u003c/p\u003e","title":"Когда микроскопия мазка важнее бакпосева?"},{"content":"\rПереключить Миф / Реальность\rОписание: Крипт, манка, болезнь белых точек - Cryptocaryon irritans это простейшие животные, видимые невооруженным глазом. Более подвержены крипту хирурговые рыбы, бабочки, кузовковые. Обычно они подхватывают бродяжек первыми. Бродяжкам легче всего зацепиться на жабрах и плавниках. Потому всегда в первую очередь нужно осматривать плавники. После того как паразит созрел и покинул хозяина, он инцистируется на дне. На 3-й сутки в цисте происходит неравномерное деление паразита. Зрелые бродяжки подвижны, выходят из цисты на 6—9-й день. В одной цисте развивается до 200 бродяжек. Их количество зависит от размера трофонта. Период их свободного плавания не более 24 ч. Сначала они плавают около цисты, а затем быстро устремляются прочь. После поражения жабр рыба начинает задыхаться. На фоне заражения криптом развиваются вторичные бактериальные инфекции. Их можно распознать по симптомам: помутнение глаз, «рваные» плавники и пр. Как нам давно известно, крипт размножается долгими циклами с переходом в стадию «бродяжек», и чтобы убить рыбу, потребуется не менее 4-5 циклов, а это не менее 1,5 месяцев. Пораженная рыба чешется, остальные рыбы так же реагируют стрессом на её поведение и в считанные часы или дни начинается массовая эпидемия и массовый мор.\nАквариумист не сможет взять мазок со слизи рыбы или отрезать кусочек плавника, чтобы под микроскопом подтвердить правильность догадки по крипту. Некоторые рыбы «всегда больны» - постоянно на их теле видны белые пятна, либо другие признаки заболевания. Это все свидетельствует о неподходящих условиях содержания\u0026hellip; Например, налили вы в аквариум воду холоднее чем надо — рыбка простудилась. Стрессы сопровождаются выработкой гормона кортизола. В довесок к проблемам роста, пищеварения и функции размножения, хронический стресс поражает иммунную систему. Все это ведет к паразитарным, бактериальным, грибковым заболеваниям и смерти рыбы.\nЕсли в аквариуме есть кораллы, то скорее всего они поглотят штаммы криптокариоза, однако даже в таком случае могут возникать незначительные вспышки.\nБорьба: УФ-стерилизатор Принцип действия стерилизатора следующий: ультрафиолет \u0026ldquo;пробивает\u0026rdquo; толщу воды, которая проходит сквозь колбу и убивает в ней одноклеточные микроорганизмы, в том числе и реснитчатых инфузорий - «бродяжек» криптокариона. Стерилизаторы обладают достаточной мощностью, чтобы убить плавающих томитов, так же как и специальные диатомовые фильтры, отлавливающие томитов. Это не значит, что он должен круглогодично работать. Нет, в основном он должен быть выключен, но при поселении в аквариум новой рыбы стерилизатор обязательно нужно включать на неделю-две. А в случае вспышки он помогает решить проблему заражения всех жителей аквариума.\nНекоторые аквариумисты вовсе не сталкивались с такой болезнью лишь потому, что правильно кормят своих рыб и качество воды на высочайшем уровне. Например, азотистые соединения – яды NH3/NH4, NO2, NO3. Зачастую эти яды и являются первопричиной заболеваний рыб. Рыбки травятся ими \u0026ndash;\u0026gt; их иммунитет падает \u0026ndash;\u0026gt; патогенная флора спокойно атакует ослабленный организм.\nМедикаменты Бродяжки малярии по структуре и принципу существования крайне схожи с бродяжками криптокариона (и те, и другие принадлежат к простейшим жгутиковым). Поэтому делагил эффективно их уничтожает. Гарантированная смерть бродяжки наступает при применении лекарств с содержанием меди. Озон сам по себе крипт победить не может. Чтобы полностью избавиться от паразита рекомендуется убрать всю рыбу из зараженного аквариума и проводить лечение в течение месяца, что бы иметь 100% уверенность в том, что все паразиты мертвы.\nmolnet.ru\nnaturewater.ru\nbiotopimage.ru\naquarium-vl.ru\nfanfishka.ru\naqhome.ru\nvk.com\nreefcentral.ru\nCryptocaryon irritans: паразит, а не просто белые точки Введение\nИнфекция — это заболевание, вызываемое микроорганизмами, которые размножаются и действуют внутри организма. Инвазия — это поражение организма паразитами, включая простейших. Несмотря на то, что протозойные заболевания иногда называют инфекциями (особенно в медицине человека), в ихтиопатологии корректнее говорить об инвазии.\nКто такой Cryptocaryon irritans? Трофонт Cryptocaryon В 1951 году E. Brown впервые описала инфузорию, паразитирующую на морских рыбах, и назвала её Cryptocaryon irritans [Brown, 1951]. Паразит поражает кожу и жабры, нарушает их физиологические функции, вызывает раздражение, гиперплазию эпителия и затруднённое дыхание. Часто наблюдаются вторичные бактериальные или грибковые инфекции [Nigrelli, Ruggieri, 1966].\nВ дикой природе тяжёлые заражения редки — из-за низкой плотности рыб и короткой стадии паразитизма. В аквариуме же C. irritans способен уничтожить всю популяцию.\nЖизненный цикл Паразит имеет четырёхфазный прямой цикл развития [Colorni, 1987; Burgess \u0026amp; Matthews, 1994; Colorni \u0026amp; Burgess, 1997]:\n* Трофонт — паразитическая стадия, живущая под слизью и/или кожей рыбы, питается её тканями. * Томонт — покидает хозяина, инцистируется на субстрате и начинает делиться. * Томит — высвобождающаяся стадия, активно ищет нового хозяина. * Новая инвазия — начинается новый цикл заражения. Почему это не просто \u0026ldquo;белые точки\u0026rdquo; Реакция рыбы зависит от вида и структуры кожи\nВаш браузер не поддерживает видео. Cryptocaryon. Жаберная форма У C. irritans нет ни зубов, ни щупалец. Он проникает под эпителий или чешую, используя вращательные движения. У рыб с крупной чешуёй паразит может располагаться под чешуёй, оставаясь незаметным даже после обработки аквариума [Zeng et al., 2023; Jee et al., 2001].\nДиагностика: \u0026ldquo;белые точки\u0026rdquo; — не диагноз Взятие соскоба Белые пятна можно спутать с пузырьками, мусором или остатками корма. Только микроскопия соскоба позволяет подтвердить наличие паразита. Иммунный ответ и физиология\nСлизь рыб играет защитную роль, участвует в иммунных реакциях и содержит:\nлейкоциты макрофаги тучные и эозинофильные клетки дендритные клетки [Gomez et al., 2013; Reverter et al., 2018] Однако при сильной инвазии гиперсекреция слизи может затруднить дыхание, особенно если поражены жабры [Zeng et al., 2023; Cervera et al., 2022; Huang et al., 2023]. Формы и штаммы паразита\nОдни штаммы преимущественно поражают кожу и наружные части жабр. Другие — жабры изнутри, вызывая их разрушение до появления видимых признаков на теле. ***** Можете ознакомится с презентацией на тему проявлений крипта *****\nЛожные представления \u0026ldquo;Паразит есть в каждом аквариуме\u0026rdquo;\nЭто миф. Чтобы паразит появился, он должен попасть в аквариум. Без цист заражения не будет.\nИсторическая справка. На протяжении веков существовало представление, что живые организмы способны возникать из неживой материи — например, личинки из гниющего мяса или микроорганизмы из грязи и воды. Эксперименты Франческо Реди (1668), показавшие связь появления личинок с доступом мух к мясу, а позднее работы Луи Пастера (1859) с колбами с изогнутым горлышком окончательно опровергли эту идею. Было доказано фундаментальное биологическое положение: жизнь возникает только из предшествующей жизни (omne vivum ex vivo). Это правило лежит в основе современной микробиологии, паразитологии и эпизоотологии.\n\u0026ldquo;Стресс вызывает криптокарионоз\u0026rdquo; Нет. Стресс ослабляет иммунитет, но не является причиной заболевания. Без паразита заболевание не начнётся.\n\u0026ldquo;Белые ошмётки — это паразиты\u0026rdquo; Нет. Это реакция иммунной системы — слизь с белками и лейкоцитами. Паразиты при этом всё ещё могут быть внутри тканей.\nПочему в природе заражений меньше?\nОбъёмы воды огромны. Рыбы не сбиваются в кучу. Цисты теряются или поедаются фильтраторами. Одна циста редко приводит к вспышке. В аквариуме даже одна выжившая циста способна вызвать массовую гибель.\nОбработка и лечение Что не работает: Пресноводные ванны — бесполезны. Слизь защищает паразита, а рыба страдает от осмотического шока [Huang et al., 2023; Jiang \u0026amp; Huang, 2023]. Чрезмерные дозы препаратов — опасны для самой рыбы [Zahid et al., 2023]. Что работает: Малахитовая зелень — проникает сквозь слизь, эффективна против трофонтов. Карантин — обязателен для любой новой рыбы. Медь - если подходящее течение болезни, дозировка и системный подход. Промывка и выдержка аквариума — до 1 месяца без рыб (или дольше\u0026hellip;лучше 3), чтобы прервать цикл паразита. Заключение Cryptocaryon irritans — это опасный протозойный паразит, а не просто косметический дефект в виде белых точек. Надёжная диагностика, понимание жизненного цикла и правильная профилактика — ключ к предотвращению вспышек.\nЛитература Colorni A. Biology of Cryptocaryon irritans and strategies for its control. // Aquaculture. 1987. Т. 67. № 1/2. С. 236–237. Zeng S. и др. Effects of Cryptocaryon irritans infection on the histopathology, oxidative stress, immune response, and intestinal microbiota in the orange-spotted grouper Epinephelus coioides // Fish \u0026amp; Shellfish Immunology. 2023. Т. 133. С. 108562. Jee B. и др. A new strain of Cryptocaryon irritans from the cultured olive flounder Paralichthys olivaceus // Diseases of aquatic organisms. 2001. Т. 43. С. 211–5. Burgess P. J., Matthews R. A. Cryptocaryon irrttans (Ciliophora): photoperiod and transmission in marine fish // Journal of the Marine Biological Association of the United Kingdom. 1994. Т. 74. № 3. С. 535–542. Colorni A., Burgess P. Cryptocaryon irritans Brown 1951, the cause of ‘white spot disease’ in marine fish: an update // Aquarium Sciences and Conservation. 1997. Т. 1. С. 217–238. Brown E. A new parasitic protozoan, the causal organism of a white spot disease in marine fish Cryptocaryon irritans gen. and sp. n. (Agenda and abstr. Sci. Meet. , Zool. Soc. London, 1950). , 1951. Cervera L. и др. Severe Natural Outbreak of Cryptocaryon irritans in Gilthead Seabream Produces Leukocyte Mobilization and Innate Immunity at the Gill Tissue // Int J Mol Sci. 2022. Т. 23. № 2. С. 937. Cheung P. J., Nigrelli R. F., Ruggieri G. D. Studies on cryptocaryoniasis in marine fish: effect of temperature and salinity on the reproductive cycle of Cryptocaryon irritans Brown, 1951 // Journal of Fish Diseases. 1979. Т. 2. № 2. С. 93–97. Gomez D., Sunyer J. O., Salinas I. The mucosal immune system of fish: the evolution of tolerating commensals while fighting pathogens // Fish Shellfish Immunol. 2013. Т. 35. № 6. С. 1729–1739. Huang K. и др. Investigating the interplay between Cryptocaryon irritans ectoparasite infection and the immune responses of the head kidney in silver pomfret (Pampus argenteus) // Aquaculture. 2023. Т. 575. С. 739780. Jiang S., Huang X. Host responses against the fish parasitizing ciliate Cryptocaryon irritans // Parasite Immunology. 2023. Т. 45. № 3. С. e12967. Nigrelli R. F., Ruggieri G. D. Enzootics in the New York Aquarium caused by Cryptocaryon irritans Brown, 1951 (=Ichthyophthirius marinus Sikama, 1961), a histophagous ciliate in the skin, eyes and gills of marine fishes // Zoologica : scientific contributions of the New York Zoological Society. 1966. Т. 51. № 9. С. 97\u0026ndash;102. Zahid A. и др. Antiparasitic effect of copper alloy mesh on tomont stage of Cryptocaryon irritans in aquaculture // Journal of Fish Diseases. 2023. Т. 46. № 3. С. 181–188. Вопросы и ответы Белые точки — это всегда крипт? Нет. Похожие признаки могут давать пузырьки, слизь или повреждения кожи.\nПочему рыба задыхается без видимых точек? Паразит может поражать жабры, не проявляясь на коже.\nКрипт есть в каждом аквариуме? Нет. Он появляется только при заносе.\nПочему вспышка развивается быстро? После выхода из цисты формируется большое количество подвижных стадий.\nМожно ли поставить диагноз без микроскопии? Нет. Внешние признаки недостаточны для точного подтверждения.\n","permalink":"https://fossamethod.ru/ru/posts/crypt/","summary":"Почему «белые точки» — это не диагноз, и почему Cryptocaryon irritans не является обязательным компонентом морского аквариума.","title":"Cryptocaryon irritans. Паразит, а не просто белые точки"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/audouinella_10x-sc_imagej/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Audouinella_10x-sc_imagej.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 10×\",\n            description: \"Общий вид кустистого таллома красной водоросли, предположительно Audouinella sp. В верхней части изображения различима область прикрепления с ризоидами. При увеличении видны  ветвящиеся клеточные нити, поперечные перегородки и предполагаемые моноспорангии.\",\n            buttonImage: \"/dzi/images/Audouinella_10x-sc_imagej.webp\",\n            dzi: \"Audouinella_10x-sc_imagej.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  5.5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Audouinella_10x-sc_imagej.json\",\n            previewAlt: \"Кустистый таллом красной водоросли, предположительно Audouinella, с ветвящимися нитями, 10×\",\n            pageUrl: \"/ru/microscope-collection/audouinella_10x-sc_imagej/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 10×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/audouinella_20x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Audouinella_20x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 20×\",\n            description: \"Разветвлённая система многоклеточных нитей. Хорошо заметны характер ветвления, сегментация нитей и округлые репродуктивные структуры, расположенные на коротких боковых ответвлениях.\",\n            buttonImage: \"/dzi/images/Audouinella_20x-sc.webp\",\n            dzi: \"Audouinella_20x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  4.1 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Audouinella_20x-sc.json\",\n            previewAlt: \"Разветвлённые нити красной водоросли с поперечными перегородками и округлыми боковыми структурами, 20×\",\n            pageUrl: \"/ru/microscope-collection/audouinella_20x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 20×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/audouinella_40x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Audouinella_40x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 40×\",\n            description: \"Детальное строение ветвящихся клеточных нитей красной водоросли. Хорошо различимы отдельные клетки, поперечные перегородки и округлые образования на боковых ответвлениях, предположительно моноспорангии.\",\n            buttonImage: \"/dzi/images/Audouinella_40x-sc.webp\",\n            dzi: \"Audouinella_40x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Audouinella_40x-sc.json\",\n            previewAlt: \"Ветвящиеся клеточные нити красной водоросли, предположительно Audouinella, при увеличении 40×\",\n            pageUrl: \"/ru/microscope-collection/audouinella_40x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"«Нитчатая красная водоросль (предположительно Audouinella sp.)» — 40×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/chromis/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Chromis.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Chromis\",\n            description: \"Чешуя рыбки Chromis viridis.\",\n            buttonImage: \"/dzi/images/Chromis.webp\",\n            dzi: \"Chromis.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  6 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Чешуя Chromis viridis в микроскопическом препарате\",\n            pageUrl: \"/ru/microscope-collection/chromis/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Chromis"},{"content":"","permalink":"https://fossamethod.ru/ru/video/cryptobia-run/","summary":"","title":"Cryptobia среди частиц детрита"},{"content":"","permalink":"https://fossamethod.ru/ru/video/cryptocaryon/","summary":"","title":"Cryptocaryon irritans в жабрах"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/discus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Discus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Discus\",\n            description: \"Чешуя рыбки Дискус.\",\n            buttonImage: \"/dzi/images/Discus.webp\",\n            dzi: \"Discus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  4 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Микроскопический препарат чешуи дискуса\",\n            pageUrl: \"/ru/microscope-collection/discus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Discus"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/gadus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Gadus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Gadus\",\n            description: \"Чешуя рыбы Минтай.\",\n            buttonImage: \"/dzi/images/Gadus.webp\",\n            dzi: \"Gadus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3.5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Чешуя минтая в микроскопическом препарате\",\n            pageUrl: \"/ru/microscope-collection/gadus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Gadus"},{"content":"","permalink":"https://fossamethod.ru/ru/video/ichtiobodo/","summary":"","title":"Ichthyobodo spp.: сравнение форм"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/labidochromis/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Labidochromis.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Labidochromis\",\n            description: \"Чешуя рыбы Лабидохромис еллоу.\",\n            buttonImage: \"/dzi/images/Labidochromis.webp\",\n            dzi: \"Labidochromis.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  8.5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Микроскопический препарат чешуи цихлиды Labidochromis\",\n            pageUrl: \"/ru/microscope-collection/labidochromis/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Labidochromis"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/monodactylus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Monodactylus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Monodactylus\",\n            description: \"Чешуя рыбы Монодактил.\",\n            buttonImage: \"/dzi/images/Monodactylus.webp\",\n            dzi: \"Monodactylus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  4.5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Чешуя рыбы Monodactylus под микроскопом\",\n            pageUrl: \"/ru/microscope-collection/monodactylus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Monodactylus"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/pleurogrammus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Pleurogrammus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Pleurogrammus\",\n            description: \"Чешуя рыбы Терпуг.\",\n            buttonImage: \"/dzi/images/Pleurogrammus.webp\",\n            dzi: \"Pleurogrammus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Микроскопический препарат чешуи терпуга Pleurogrammus\",\n            pageUrl: \"/ru/microscope-collection/pleurogrammus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Pleurogrammus"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/pterophyllum/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Pterophyllum.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Pterophyllum\",\n            description: \"Чешуя рыбки Скалярия.\",\n            buttonImage: \"/dzi/images/Pterophyllum.webp\",\n            dzi: \"Pterophyllum.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Чешуя скалярии Pterophyllum scalare под микроскопом\",\n            pageUrl: \"/ru/microscope-collection/pterophyllum/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Pterophyllum"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/secret/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Secret.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Secret\",\n            description: \"Есть тут что-нибудь?\",\n            buttonImage: \"/dzi/images/Secret.webp\",\n            dzi: \"Secret.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.2 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Микроскопический препарат из коллекции Secret; объект для самостоятельного поиска\",\n            pageUrl: \"/ru/microscope-collection/secret/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Secret"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/micopano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"micoPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Ветвящиеся нитевидные бактерии — 100×\",\n            description: \"Мазок-отпечаток селезёнки. Окраска по Цилю — Нильсену. Объектив 100×. Фуксин-положительные палочковидные и нитевидные структуры с выраженным ветвлением и неравномерным окрашиванием. Морфология характерна для ветвящихся актиномицетов, в том числе Nocardia.\",\n            buttonImage: \"/dzi/images/micoPano.webp\",\n            dzi: \"micoPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.9 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Ветвящиеся нитевидные фуксин-положительные бактерии в мазке селезёнки рыбы, 100×\",\n            pageUrl: \"/ru/microscope-collection/micopano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Ветвящиеся нитевидные бактерии — 100×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/mico2pano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"mico2Pano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Ветвящиеся палочковидные бактерии — 40×\",\n            description: \"Мазок-отпечаток селезёнки. Окраска по Цилю — Нильсену. Объектив 40×. Фуксин-положительные палочковидные и удлинённые структуры с предполагаемым ветвлением. Морфология допускает принадлежность к роду Nocardia или другим актиномицетам.\",\n            buttonImage: \"/dzi/images/mico2Pano.webp\",\n            dzi: \"mico2Pano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/mico2Pano.json\",\n            previewAlt: \"Фуксин-положительные удлинённые и предположительно ветвящиеся бактерии в мазке селезёнки рыбы, 40×\",\n            pageUrl: \"/ru/microscope-collection/mico2pano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Ветвящиеся палочковидные бактерии — 40×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/gistopano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"gistoPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Внутриклеточные паразиты 100x\",\n            description: \"Мазок печени хризиптеры 100x. Окраска по Май-Грюнвальду. Паразиты в гистиоцитах.\",\n            buttonImage: \"/dzi/images/gistoPano.webp\",\n            dzi: \"gistoPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Мазок печени хризиптеры с предполагаемыми внутриклеточными паразитами в гистиоцитах, 100×\",\n            pageUrl: \"/ru/microscope-collection/gistopano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Внутриклеточные паразиты 100x"},{"content":"","permalink":"https://fossamethod.ru/ru/video/autopsy/","summary":"","title":"Вскрытие рыбы"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/yeast_like_fungal_cells_100/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"yeast_like_fungal_cells_100.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Гифальные и спорангиальные структуры\",\n            description: \"Препарат содержимого кишечника при большом увеличении, окраска по Май–Грюнвальду. Видны гифальные структуры и округлые спорангиальные формы, расположенные среди слизи и фрагментов пищевых масс. В сочетании с массовым присутствием дрожжеподобных клеток в содержимом желудка такая картина указывает на выраженное грибковое поражение пищеварительного тракта. Снято объективом 100x.\",\n            buttonImage: \"/dzi/images/yeast_like_fungal_cells_100.webp\",\n            dzi: \"yeast_like_fungal_cells_100.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.2 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Гифальные и округлые структуры в окрашенном по Май–Грюнвальду препарате содержимого кишечника, 100×\",\n            pageUrl: \"/ru/microscope-collection/yeast_like_fungal_cells_100/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Гифальные и спорангиальные структуры"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/kidney_scalare_20x/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Kidney_scalare_20x.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Гранулёмы в почке скалярии\",\n            description: \"Микроскопическая панорама ткани почки скалярии (Pterophyllum scalare) с гранулематозными образованиями. Среди почечных структур видны участки скопления изменённого клеточного материала и тёмноокрашенные включения. При исследовании препарата выявлены кислотоустойчивые бактерии, что позволяет предполагать микобактериальную природу поражения. Видовая принадлежность бактерий не установлена.\",\n            buttonImage: \"/dzi/images/Kidney_scalare_20x.webp\",\n            dzi: \"Kidney_scalare_20x.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  14.201373370652101 ,\n            image_microns_per_pixel:  0.5928379483333229 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Kidney_scalare_20x.json\",\n            previewAlt: \"Микроскопическая панорама почки скалярии с гранулематозными образованиями, тёмными скоплениями материала и окружающими почечными структурами.\",\n            pageUrl: \"/ru/microscope-collection/kidney_scalare_20x/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Гранулёмы в почке скалярии"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/fungal_structures_40x/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Fungal_structures_40x.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Грибковые структуры\",\n            description: \"Препарат слизи и содержимого пустого желудка чёрного ножа (Apteronotus albifrons). Видны многочисленные нитевидные грибковые структуры, расположенные среди слизи, детрита и мелких округлых элементов. Такая картина указывает на выраженное присутствие грибковых форм в просвете желудка и является патологически значимой находкой. Снято при использовании объектива ×40.\",\n            buttonImage: \"/dzi/images/Fungal_structures_40x.webp\",\n            dzi: \"Fungal_structures_40x.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Нитевидные грибковые структуры среди слизи и содержимого желудка чёрного ножа, 40×\",\n            pageUrl: \"/ru/microscope-collection/fungal_structures_40x/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Грибковые структуры"},{"content":"","permalink":"https://fossamethod.ru/ru/video/fungi-native/","summary":"","title":"Грибковые структуры в нативном препарате"},{"content":"","permalink":"https://fossamethod.ru/ru/video/fungi-in-fish/","summary":"","title":"Грибы в тканях рыбы"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/gills_damage/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Gills_damage.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Дегенерированные жабры погибшей рыбы\",\n            description: \"Даже выраженно посмертно изменённые жабры могут сохранять диагностически значимые находки. На препарате можно обнаружить прикреплённых моногеней, что позволяет судить о возможных паразитарных угрозах и понять, что следует искать у живых рыб. Кто найдет больше?\",\n            buttonImage: \"/dzi/images/Gills_damage.webp\",\n            dzi: \"Gills_damage.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  20 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Gills_damage.json\",\n            previewAlt: \"Посмертно изменённые жабры рыбы с прикреплёнными моногенеями в микроскопическом препарате\",\n            pageUrl: \"/ru/microscope-collection/gills_damage/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Дегенерированные жабры погибшей рыбы"},{"content":"","permalink":"https://fossamethod.ru/ru/video/ichthyophthirius/","summary":"","title":"Деление Ichthyophthirius multifiliis"},{"content":"Совет: нажмите Ctrl + колесо мыши, чтобы изменить масштаб страницы. Выберите размер, с которым вам будет удобно работать.\n","permalink":"https://fossamethod.ru/ru/test/reasoning-test/","summary":"Интерактивный тренажёр рассуждений: наблюдение, выводы, ограничения данных.","title":"Диагностическое мышление"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/diatoms_braun_40x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Diatoms_Braun_40x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Диатомовые водоросли морского аквариума\",\n            description: \"Микроскопическая панорама бурого налёта, собранного со стекла морского аквариума. Под микроскопом видны многочисленные диатомовые водоросли, отличающиеся формой, размерами и строением. Большинство из них имеют вытянутую или овальную форму. Их золотисто-бурые хлоропласты заключены внутри прозрачных кремнезёмных оболочек, на которых хорошо заметны тонкие линии и узоры.\",\n            buttonImage: \"/dzi/images/Diatoms_Braun_40x-sc.webp\",\n            dzi: \"Diatoms_Braun_40x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.411026614392012 ,\n            image_microns_per_pixel:  0.09243155463620088 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Diatoms_Braun_40x-sc.json\",\n            previewAlt: \"Многочисленные золотисто-бурые диатомовые водоросли различной формы и размера, с прозрачными кремнезёмными оболочками и тонкими узорами на поверхности.\",\n            pageUrl: \"/ru/microscope-collection/diatoms_braun_40x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Диатомовые водоросли морского аквариума"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/yeast_like_fungal_cells_40/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"yeast_like_fungal_cells_40.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Дрожжеподобные структуры\",\n            description: \"Препарат содержимого желудка голубого неона (Paracheirodon innesi), окраска по Май–Грюнвальду. Видны многочисленные округлые розово-фиолетовые структуры со светлым капсулоподобным ободком. Морфологически они соответствуют дрожжеподобным грибковым клеткам, перемешанным с пищевыми массами. Снято объективом 40x.\",\n            buttonImage: \"/dzi/images/yeast_like_fungal_cells_40.webp\",\n            dzi: \"yeast_like_fungal_cells_40.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/yeast_like_fungal_cells_40.json\",\n            previewAlt: \"Округлые розово-фиолетовые дрожжеподобные структуры в содержимом желудка неона, 40×\",\n            pageUrl: \"/ru/microscope-collection/yeast_like_fungal_cells_40/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Дрожжеподобные структуры"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/jillsnecrozpano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"jillsNecrozPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Жабры\",\n            description: \"Некроз жаберных лепестков\",\n            buttonImage: \"/dzi/images/jillsNecrozPano.webp\",\n            dzi: \"jillsNecrozPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  10 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Микроскопический препарат жабр рыбы с повреждёнными и некротизированными жаберными лепестками\",\n            pageUrl: \"/ru/microscope-collection/jillsnecrozpano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Жабры"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/gills_ciprinus-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Gills_ciprinus-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Жабры сазана (Cyprinus carpio)\",\n            description: \"Хорошо видны жаберные нити с многочисленными поперечными лепестками — основными участками газообмена. При большом увеличении можно рассмотреть тонкие стенки лепестков, кровеносные капилляры и клетки крови внутри них.\",\n            buttonImage: \"/dzi/images/Gills_ciprinus-sc.webp\",\n            dzi: \"Gills_ciprinus-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  2.233662263419819 ,\n            image_microns_per_pixel:  0.12827936343190993 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Gills_ciprinus-sc.json\",\n            previewAlt: \"Жаберные нити и поперечные жаберные лепестки сазана (Cyprinus carpio) под микроскопом\",\n            pageUrl: \"/ru/microscope-collection/gills_ciprinus-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Жабры сазана (Cyprinus carpio)"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/seaweed_20x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"seaweed_20X-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Заросли зеленых водорослей в морском аквариуме.\",\n            description: \"Обрастания с наружной поверхности трубы подачи воды в морском аквариуме. Под микроскопом видны длинные зелёные нити, среди которых расположились многочисленные золотисто-бурые диатомовые водоросли. Они отличаются формой и размерами и вместе с нитчатыми водорослями образуют целое подводное сообщество.\",\n            buttonImage: \"/dzi/images/seaweed_20X-sc.webp\",\n            dzi: \"seaweed_20X-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  6.808220644802301 ,\n            image_microns_per_pixel:  0.2484386941799429 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/seaweed_20X-sc.json\",\n            previewAlt: \"Микроскопическая панорама зелёных нитчатых обрастаний с многочисленными золотисто-бурыми диатомовыми водорослями различной формы.\",\n            pageUrl: \"/ru/microscope-collection/seaweed_20x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Заросли зеленых водорослей в морском аквариуме."},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/green_algal-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Green_algal-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Зелёные микроводоросли на стекле аквариума\",\n            description: \"Зелёные обрастания со стекла пресноводного аквариума. Невооружённым глазом они выглядят как небольшие зелёные точки, плотно прикреплённые к поверхности стекла. Под микроскопом видны многочисленные округлые клетки, образующие плотные скопления. Внутри клеток различимы зелёные хлоропласты, обеспечивающие фотосинтез.\",\n            buttonImage: \"/dzi/images/Green_algal-sc.webp\",\n            dzi: \"Green_algal-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.6086160498769677 ,\n            image_microns_per_pixel:  0.04461994500564279 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Green_algal-sc.json\",\n            previewAlt: \"Плотное скопление округлых клеток зелёных микроводорослей с различимыми клеточными границами и зелёным содержимым.\",\n            pageUrl: \"/ru/microscope-collection/green_algal-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Зелёные микроводоросли на стекле аквариума"},{"content":"","permalink":"https://fossamethod.ru/ru/presentations/base_2025/","summary":"","title":"Интеграция биологических и экологических параметров в базе данных."},{"content":"","permalink":"https://fossamethod.ru/ru/video/ciliate-and-bacter/","summary":"","title":"Инфузории и бактерии на поверхности рыбы"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/capsalidae_2_10x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Capsalidae_2_10x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Капсалида — общий препарат\",\n            description: \"Панорамный микропрепарат капсалиды. Хорошо различимы фаринкс, кишечные ветви, желточники, яичник, семенники и задний прикрепительный аппарат — гаптор.\",\n            buttonImage: \"/dzi/images/Capsalidae_2_10x-sc.webp\",\n            dzi: \"Capsalidae_2_10x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  6 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Capsalidae_2_10x-sc.json\",\n            previewAlt: \"Капсалида под микроскопом: общий вид паразита, внутренние органы и задний прикрепительный аппарат\",\n            pageUrl: \"/ru/microscope-collection/capsalidae_2_10x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Капсалида — общий препарат"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/capsalidae_10x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Capsalidae_10x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Капсалида — рельеф внутренних структур\",\n            description: \"Вторая панорама того же препарата с более выраженным рельефом. Лучше различимы контуры и взаимное расположение внутренних органов, особенно элементов половой системы, кишечных ветвей и структур задней части тела.\",\n            buttonImage: \"/dzi/images/Capsalidae_10x-sc.webp\",\n            dzi: \"Capsalidae_10x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Capsalidae_10x-sc.json\",\n            previewAlt: \"Панорамный препарат моногенеи семейства Capsalidae с различимыми внутренними структурами\",\n            pageUrl: \"/ru/microscope-collection/capsalidae_10x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Капсалида — рельеф внутренних структур"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/blood_stingray/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Blood_stingray.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Клетки крови ската\",\n            description: \"Микроскопическая панорама окрашенного мазка крови ската. Основную массу составляют овальные эритроциты с хорошо различимыми ядрами. Среди них встречаются различные лейкоциты, включая эозинофильные гранулоциты и крупные клетки с обильной цитоплазмой. Панорама позволяет сравнить форму, размеры и особенности строения разных клеток крови.\\n\",\n            buttonImage: \"/dzi/images/Blood_stingray.webp\",\n            dzi: \"Blood_stingray.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.5932511405836862 ,\n            image_microns_per_pixel:  0.09662119853272712 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Blood_stingray.json\",\n            previewAlt: \"Микроскопическая панорама крови ската с многочисленными ядросодержащими эритроцитами и лейкоцитами различной формы и размера.\",\n            pageUrl: \"/ru/microscope-collection/blood_stingray/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Клетки крови ската"},{"content":"","permalink":"https://fossamethod.ru/ru/presentations/crypt_2024/","summary":"","title":"Клинические случаи нетипичной формы криптокарионоза"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/kokki/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Kokki.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Кокки\",\n            description: \"Кокковидные бактерии.\",\n            buttonImage: \"/dzi/images/Kokki.webp\",\n            dzi: \"Kokki.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.63 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Kokki.json\",\n            previewAlt: \"Кокковидные бактерии в микроскопическом препарате\",\n            pageUrl: \"/ru/microscope-collection/kokki/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Кокки"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/kidney_neon_granulema_%D1%81ontrast-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Kidney_neon_granulema_сontrast-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Конкременты в почке неона\",\n            description: \"Микроскопический препарат почки неона. Округлые и овальные образования различного размера с чёткими контурами и неоднородным содержимым, предположительно минеральные конкременты. Некоторые окружены клеточными структурами, напоминающими гранулематозную реакцию. Микобактерии не выявлены, аналогичные образования в других органах не обнаружены.\",\n            buttonImage: \"/dzi/images/Kidney_neon_granulema_сontrast-sc.webp\",\n            dzi: \"Kidney_neon_granulema_сontrast-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  8 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Kidney_neon_granulema_сontrast-sc.json\",\n            previewAlt: \"Микропрепарат почки неона с округлыми образованиями различного размера, предположительно конкрементами\",\n            pageUrl: \"/ru/microscope-collection/kidney_neon_granulema_%D1%81ontrast-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Конкременты в почке неона"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/crypto2pano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"crypto2Pano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Криптоспоридии 100x\",\n            description: \"Мазок печени данио. Окраска по Цилю-Нильсену. Объектив 100x.\",\n            buttonImage: \"/dzi/images/crypto2Pano.webp\",\n            dzi: \"crypto2Pano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.34 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/crypto2Pano.json\",\n            previewAlt: \"Мазок печени данио, окрашенный по Цилю — Нильсену, с предполагаемыми паразитарными структурами, 100×\",\n            pageUrl: \"/ru/microscope-collection/crypto2pano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Криптоспоридии 100x"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/cryptopano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"cryptoPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Криптоспоридии 100x\",\n            description: \"Мазок печени данио. Окраска по Май-Грюнвальду. Объектив 100x.\",\n            buttonImage: \"/dzi/images/cryptoPano.webp\",\n            dzi: \"cryptoPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.34 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/cryptoPano.json\",\n            previewAlt: \"Мазок печени данио, окрашенный по Май–Грюнвальду, с предполагаемыми паразитарными структурами, 100×\",\n            pageUrl: \"/ru/microscope-collection/cryptopano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Криптоспоридии 100x"},{"content":"","permalink":"https://fossamethod.ru/ru/video/ziehl/","summary":"","title":"Лёффлер и Циль"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/amphiprion_pol_sc-3mm/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Amphiprion_pol_sc-3mm.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Личинка рыбы-клоуна (Amphiprion sp.) в поляризованном свете\",\n            description: \"На панораме представлена личинка рыбы-клоуна длиной около 3 мм. Благодаря прозрачности тела можно рассмотреть внутренние структуры, крупные глаза, позвоночник, пигментные клетки и развивающиеся плавники. Поляризованный свет подчёркивает особенности строения тканей и создаёт необычные цветовые оттенки.\",\n            buttonImage: \"/dzi/images/Amphiprion_pol_sc-3mm.webp\",\n            dzi: \"Amphiprion_pol_sc-3mm.dzi\",\n            unit: \"mm\",\n            microns_per_pixel:  4.964314679637671 ,\n            image_microns_per_pixel:  0.4476957313073557 ,\n            calibration_unit: \"mm\",\n            roi_file: \"/annotations/Amphiprion_pol_sc-3mm.json\",\n            previewAlt: \"Личинка рыбы-клоуна (Amphiprion sp.) длиной около 3 мм в поляризованном свете\",\n            pageUrl: \"/ru/microscope-collection/amphiprion_pol_sc-3mm/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Личинка рыбы-клоуна (Amphiprion sp.) в поляризованном свете"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/amphiprion_black_3mm-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Amphiprion_black_3mm-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Личинка рыбы-клоуна (Amphiprion sp.) в темном поле\",\n            description: \"На панораме представлена личинка рыбы-клоуна длиной около 3 мм. Благодаря прозрачности тела можно рассмотреть внутренние структуры, крупные глаза, позвоночник, пигментные клетки и развивающиеся плавники. \",\n            buttonImage: \"/dzi/images/Amphiprion_black_3mm-sc.webp\",\n            dzi: \"Amphiprion_black_3mm-sc.dzi\",\n            unit: \"mm\",\n            microns_per_pixel:  4.980983308888304 ,\n            image_microns_per_pixel:  0.4040100778575707 ,\n            calibration_unit: \"mm\",\n            roi_file: \"/annotations/Amphiprion_black_3mm-sc.json\",\n            previewAlt: \"Прозрачная личинка рыбы-клоуна (Amphiprion sp.) длиной около 3 мм в тёмном поле\",\n            pageUrl: \"/ru/microscope-collection/amphiprion_black_3mm-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Личинка рыбы-клоуна (Amphiprion sp.) в темном поле"},{"content":"","permalink":"https://fossamethod.ru/ru/video/ciliated-epithelium/","summary":"","title":"Мерцательный эпителий почки"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/nematodpano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"nematodPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Микрочерви\",\n            description: \"Микрочерви в оболочке мозга ската 20x. Мелкие нематоды.\",\n            buttonImage: \"/dzi/images/nematodPano.webp\",\n            dzi: \"nematodPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  5 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Мелкие нематоды в препарате оболочки головного мозга ската, объектив 20×\",\n            pageUrl: \"/ru/microscope-collection/nematodpano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Микрочерви"},{"content":"","permalink":"https://fossamethod.ru/ru/video/praziquantel/","summary":"","title":"Миф о растворении празиквантела"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/miki_without_acid_40x/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"miki_without_acid_40x.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Модифицированная окраска без кислотного обесцвечивания\",\n            description: \"В тканевом материале видны интенсивно окрашенные красно-розовые палочковидные бактерии на контрастном фоне. Кислотное обесцвечивание не проводилось, поэтому кислотоустойчивость бактерий не оценивалась. Увеличение 400x. Попробуйте найти все...\",\n            buttonImage: \"/dzi/images/miki_without_acid_40x.webp\",\n            dzi: \"miki_without_acid_40x.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.25 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/miki_without_acid_40x.json\",\n            previewAlt: \"Красно-розовые палочковидные бактерии в препарате после окраски фуксином без кислотного обесцвечивания\",\n            pageUrl: \"/ru/microscope-collection/miki_without_acid_40x/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Модифицированная окраска без кислотного обесцвечивания"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/filamentous_bacteria_2-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Filamentous_Bacteria_2-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Нитевидные бактерии в мазке с жабр рыбы\",\n            description: \"Микроскопическая панорама мазка с жабр рыбы, окрашенного по Май–Грюнвальду. Видны многочисленные тонкие нитевидные и палочковидные структуры, местами образующие плотные скопления. Морфологически они напоминают бактерии, встречающиеся при колумнарисоподобных поражениях жабр. Видовая принадлежность микроорганизмов не установлена.\",\n            buttonImage: \"/dzi/images/Filamentous_Bacteria_2-sc.webp\",\n            dzi: \"Filamentous_Bacteria_2-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.5214225799747558 ,\n            image_microns_per_pixel:  0.10076452377017524 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Filamentous_Bacteria_2-sc.json\",\n            previewAlt: \"Мазок с жабр рыбы, окрашенный по Май–Грюнвальду: многочисленные тонкие синие нити, палочковидные структуры и скопления окрашенного клеточного материала.\",\n            pageUrl: \"/ru/microscope-collection/filamentous_bacteria_2-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Нитевидные бактерии в мазке с жабр рыбы"},{"content":"","permalink":"https://fossamethod.ru/ru/video/buble/","summary":"","title":"Образование пузырьков"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/gills_coregonus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Gills_Coregonus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Омуль (Coregonus sp.) — строение жаберного аппарата\",\n            description: \"Панорамный препарат жаберного аппарата омуля (Coregonus sp.). Различимы жаберная дуга, многочисленные жаберные нити (первичные лепестки) и расположенные на них вторичные жаберные пластинки — ламеллы. При увеличении хорошо видна регулярная поперечная структура ламелл, формирующих основную поверхность газообмена.\",\n            buttonImage: \"/dzi/images/Gills_Coregonus.webp\",\n            dzi: \"Gills_Coregonus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  14.393876010418436 ,\n            image_microns_per_pixel:  1.3796461451459918 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Gills_Coregonus.json\",\n            previewAlt: \"Жаберный аппарат омуля (Coregonus sp.) под микроскопом: жаберная дуга, первичные жаберные нити и многочисленные вторичные пластинки — ламеллы.\",\n            pageUrl: \"/ru/microscope-collection/gills_coregonus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Омуль (Coregonus sp.) — строение жаберного аппарата"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/bolbitis_40x_2/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Bolbitis_40x_2.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Папоротник Bolbitis — клетки листа, 40×\",\n            description: \"На панораме представлен участок листа аквариумного папоротника больбитиса. Хорошо видны растительные клетки различной формы с многочисленными зелёными хлоропластами. При увеличении можно рассмотреть клеточные стенки, расположение хлоропластов и особенности строения листовой ткани.\",\n            buttonImage: \"/dzi/images/Bolbitis_40x_2.webp\",\n            dzi: \"Bolbitis_40x_2.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  5.638616473646889 ,\n            image_microns_per_pixel:  0.23899375162098732 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Bolbitis_40x_2.json\",\n            previewAlt: \"Клетки листа папоротника Bolbitis с многочисленными зелёными хлоропластами и различимыми клеточными стенками\",\n            pageUrl: \"/ru/microscope-collection/bolbitis_40x_2/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Папоротник Bolbitis — клетки листа, 40×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/bolbitis_10x_2/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Bolbitis_10x_2.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Папоротник Bolbitis — лист, 10×\",\n            description: \"Лист папоротника Bolbitis под микроскопом, 10×: жилки и многоугольные контуры клеток\",\n            buttonImage: \"/dzi/images/Bolbitis_10x_2.webp\",\n            dzi: \"Bolbitis_10x_2.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  11.254374437526021 ,\n            image_microns_per_pixel:  0.6665163404207515 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Bolbitis_10x_2.json\",\n            previewAlt: \"Лист папоротника Bolbitis под микроскопом, 10×: жилки и многоугольные контуры клеток\",\n            pageUrl: \"/ru/microscope-collection/bolbitis_10x_2/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Папоротник Bolbitis — лист, 10×"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/marine_fouling_algae/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Marine_fouling_algae.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Перистые зелёные водоросли морского аквариума\",\n            description: \"Микроскопическая панорама зелёных обрастаний из морского аквариума, предположительно относящихся к роду Bryopsis. Тонкие ветвящиеся нити напоминают маленькие ёлочки или птичьи перья. От центральной оси отходят многочисленные боковые выросты с зелёным содержимым. Особенность таких водорослей — отсутствие обычного деления слоевища на отдельные клетки с поперечными перегородками.\",\n            buttonImage: \"/dzi/images/Marine_fouling_algae.webp\",\n            dzi: \"Marine_fouling_algae.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  6.4072599558884775 ,\n            image_microns_per_pixel:  1.4350074155654506 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Marine_fouling_algae.json\",\n            previewAlt: \"Перистое ветвящееся слоевище зелёной морской водоросли с центральной осью и многочисленными удлинёнными боковыми выростами на чёрном фоне.\",\n            pageUrl: \"/ru/microscope-collection/marine_fouling_algae/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Перистые зелёные водоросли морского аквариума"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/granulomaapteronotus/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"GranulomaApteronotus.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Печень Apteronotus albifrons с гранулематозными очагами\",\n            description: \"Компрессионный препарат из кишечника Apteronotus albifrons. Видны множественные гранулематозные очаги, связанные с микобактериальной инфекцией. Однако по одной морфологии очагов невозможно определить их этиологию без дополнительных исследований.\",\n            buttonImage: \"/dzi/images/Granuloma_Apteronotus.webp\",\n            dzi: \"GranulomaApteronotus.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  7 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/GranulomaApteronotus.json\",\n            previewAlt: \"Микропрепарат тканей чёрного ножа Apteronotus albifrons с множественными гранулематозными очагами\",\n            pageUrl: \"/ru/microscope-collection/granulomaapteronotus/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Печень Apteronotus albifrons с гранулематозными очагами"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/liver_lipid_10x/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Liver_lipid_10x.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Печень с жировыми включениями\",\n            description: \"Компрессионный препарат печени голубого неона (Paracheirodon innesi). Видны многочисленные округлые жировые включения, неравномерное окрашивание ткани и участки выраженного кровенаполнения. Такая картина отражает тяжёлое нарушение состояния печени и должна оцениваться вместе с другими находками. Снято при использовании объектива 10x.\",\n            buttonImage: \"/dzi/images/Liver_lipid_10x.webp\",\n            dzi: \"Liver_lipid_10x.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  7 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Компрессионный препарат печени неона с многочисленными округлыми жировыми включениями, 10×\",\n            pageUrl: \"/ru/microscope-collection/liver_lipid_10x/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Печень с жировыми включениями"},{"content":"","permalink":"https://fossamethod.ru/ru/video/color/","summary":"","title":"Пигмент или кокки?"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/mold/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Mold.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Пигментированные грибковые структуры на жабрах краба\",\n            description: \"Фрагмент панорамы жабр краба с ветвящимися септированными гифами и многочисленными пигментированными округлыми структурами. Макроскопически поражённые участки жабр имели чёрную окраску и признаки разрушения ткани.\",\n            buttonImage: \"/dzi/images/Mold.webp\",\n            dzi: \"Mold.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  3 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Жабры краба с ветвящимися пигментированными грибковыми гифами и округлыми структурами\",\n            pageUrl: \"/ru/microscope-collection/mold/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Пигментированные грибковые структуры на жабрах краба"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/fouling_10x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"fouling_10x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Пластинчатые бурые водоросли морского аквариума\",\n            description: \"Небольшие листовидные обрастания, собранные со стенки морского тропического аквариума. Под микроскопом видны тонкие бурые пластинки, состоящие из множества клеток. Клетки образуют ряды, которые местами расходятся веером. В отличие от нитчатых водорослей, здесь формируется широкое слоевище, напоминающее маленький лист.\",\n            buttonImage: \"/dzi/images/fouling_10x-sc.webp\",\n            dzi: \"fouling_10x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  12.315279164747666 ,\n            image_microns_per_pixel:  0.5591849495195526 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/fouling_10x-sc.json\",\n            previewAlt: \"Микроскопическая панорама бурого пластинчатого слоевища с веерообразно расходящимися рядами клеток и неровными краями.\",\n            pageUrl: \"/ru/microscope-collection/fouling_10x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Пластинчатые бурые водоросли морского аквариума"},{"content":"","permalink":"https://fossamethod.ru/ru/presentations/medicines_2026/","summary":"","title":"Показания и ограничения к применению лекарственных препаратов в аквариумных системах"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/keta_kidney_4x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Keta_kidney_4x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Почка кеты — сохранённая структура\",\n            description: \"Панорамный компрессионный препарат почки клинически здоровой кеты после эвтаназии. Канальцы сохраняют обычную структуру и сравнительно светлые просветы, кровенаполнение ткани относительно равномерное. Препарат используется как контроль для сравнения с патологическими изменениями почечных канальцев.\",\n            buttonImage: \"/dzi/images/Keta_kidney_4x-sc.webp\",\n            dzi: \"Keta_kidney_4x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  17 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Keta_kidney_4x-sc.json\",\n            previewAlt: \"Компрессионный препарат почки кеты с относительно сохранёнными почечными канальцами и их просветами\",\n            pageUrl: \"/ru/microscope-collection/keta_kidney_4x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Почка кеты — сохранённая структура"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/kidney_1-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Kidney_1-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Почка лакедры — деструкция канальцев\",\n            description: \"Панорамный компрессионный препарат почки лакедры. Можно сравнить участки с относительно сохранёнными светлыми просветами канальцев и зоны, где просветы заполнены тёмным содержимым, что соответствует выраженным патологическим изменениям.\",\n            buttonImage: \"/dzi/images/Kidney_1-sc.webp\",\n            dzi: \"Kidney_1-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  15.2 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Kidney_1-sc.json\",\n            previewAlt: \"Почка лакедры под микроскопом: зоны с сохранёнными и заполненными тёмным содержимым просветами канальцев\",\n            pageUrl: \"/ru/microscope-collection/kidney_1-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Почка лакедры — деструкция канальцев"},{"content":"","permalink":"https://fossamethod.ru/ru/presentations/parasite_2025/","summary":"","title":"Прижизненная диагностика рыб в условиях океанариума: мониторинг здоровья и современные методы"},{"content":"Совет: нажмите Ctrl + колесо мыши, чтобы изменить масштаб страницы. Выберите размер, с которым вам будет удобно работать.\n","permalink":"https://fossamethod.ru/ru/butterflyfish-diagnostic-game/butterflyfish-diagnostic-game/","summary":"Интерактивная текстовая игра: наблюдения, микроскопия, выбор действия и разбор.","title":"Рыбы-бабочки: диагностический случай."},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/pano_20261028_122120/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"PANO_20261028_122120.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Ряска_темное поле.\",\n            description: \"На панораме представлены маленькие зелёные пластинки ряски — одного из самых миниатюрных цветковых растений. Хорошо видны их округлые очертания, многочисленные клетки и более светлые участки тканей. Ряска свободно плавает на поверхности воды и способна быстро размножаться, образуя новые дочерние растения.\",\n            buttonImage: \"/dzi/images/PANO_20261028_122120.webp\",\n            dzi: \"PANO_20261028_122120.dzi\",\n            unit: \"mm\",\n            microns_per_pixel:  9.397577162957717 ,\n            image_microns_per_pixel:  0.5726761485434831 ,\n            calibration_unit: \"mm\",\n            roi_file: \"/annotations/PANO_20261028_122120.json\",\n            previewAlt: \"Округлые зелёные пластинки ряски в тёмном поле: материнское и дочернее растения\",\n            pageUrl: \"/ru/microscope-collection/pano_20261028_122120/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Ряска_темное поле."},{"content":"","permalink":"https://fossamethod.ru/ru/video/heat-fish/","summary":"","title":"Сердце личинки ротана под микроскопом"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/sagittaria_10x-cs/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Sagittaria_10x-cs.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Стрелолист (Sagittaria sp.)\",\n            description: \"На панораме представлен участок листа аквариумного стрелолиста. Хорошо видны многочисленные растительные клетки с зелёными хлоропластами, продольные жилки и зубчатый край листа. При увеличении можно рассмотреть форму отдельных клеток, их стенки и расположение хлоропластов.\",\n            buttonImage: \"/dzi/images/Sagittaria_10x-cs.webp\",\n            dzi: \"Sagittaria_10x-cs.dzi\",\n            unit: \"mm\",\n            microns_per_pixel:  18.916237413562584 ,\n            image_microns_per_pixel:  0.8765361044623654 ,\n            calibration_unit: \"mm\",\n            roi_file: \"/annotations/Sagittaria_10x-cs.json\",\n            previewAlt: \"Участок листа стрелолиста (Sagittaria sp.): клетки с хлоропластами, продольные жилки и зубчатый край\",\n            pageUrl: \"/ru/microscope-collection/sagittaria_10x-cs/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Стрелолист (Sagittaria sp.)"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/sagittaria_20x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Sagittaria_20x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Стрелолист (Sagittaria sp.)_20x\",\n            description: \"На панораме представлен участок листа аквариумного стрелолиста. Хорошо видны многочисленные растительные клетки с чёткими стенками и зелёными хлоропластами. Можно рассмотреть форму отдельных клеток, расположение хлоропластов вдоль их стенок и светлые центральные участки, занятые крупными вакуолями.\",\n            buttonImage: \"/dzi/images/Sagittaria_20x-sc.webp\",\n            dzi: \"Sagittaria_20x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  4.872654402913997 ,\n            image_microns_per_pixel:  0.25327060142126057 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Sagittaria_20x-sc.json\",\n            previewAlt: \"Клетки листа стрелолиста (Sagittaria sp.) с чёткими стенками и зелёными хлоропластами\",\n            pageUrl: \"/ru/microscope-collection/sagittaria_20x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Стрелолист (Sagittaria sp.)_20x"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/sagittaria_pol_20x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Sagittaria_pol_20x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Стрелолист (Sagittaria sp.)— 20x, поляризованный свет\",\n            description: \"На панораме представлен участок листа аквариумного стрелолиста в поляризованном свете. Хорошо видны многочисленные растительные клетки, продольные жилки и заострённые зубчики по краю листа. Поляризация создаёт золотистые оттенки и подчёркивает границы клеток, позволяя рассмотреть строение листа в необычном освещении.\",\n            buttonImage: \"/dzi/images/Sagittaria_pol_20x-sc.webp\",\n            dzi: \"Sagittaria_pol_20x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  9.266613381675445 ,\n            image_microns_per_pixel:  0.50385553288289 ,\n            calibration_unit: \"µm\",\n            roi_file: \"/annotations/Sagittaria_pol_20x-sc.json\",\n            previewAlt: \"Лист стрелолиста (Sagittaria sp.) в поляризованном свете: клетки, продольные жилки и зубчики края\",\n            pageUrl: \"/ru/microscope-collection/sagittaria_pol_20x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Стрелолист (Sagittaria sp.)— 20x, поляризованный свет"},{"content":"","permalink":"https://fossamethod.ru/ru/video/fin-erosion/","summary":"","title":"Строение плавникового луча"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/mikism/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"MikiSm.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Тонкие фуксин-положительные бактерии\",\n            description: \"Мазок-отпечаток. Окраска по Цилю — Нильсену. Многочисленные тонкие палочковидные бактерии на фоне клеточных элементов. Морфологические признаки не позволяют установить родовую принадлежность.\",\n            buttonImage: \"/dzi/images/MikiSm.webp\",\n            dzi: \"MikiSm.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.6 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/MikiSm.json\",\n            previewAlt: \"Многочисленные тонкие фуксин-положительные палочковидные бактерии среди клеточных элементов мазка\",\n            pageUrl: \"/ru/microscope-collection/mikism/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Тонкие фуксин-положительные бактерии"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/fibrosus_peskar_10x-sc/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"Fibrosus_Peskar_10x-sc.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Фиброзные узловые образования у пескаря\",\n            description: \"Компрессионный препарат тканей пескаря (Gobio gobio). Множественные округлые образования различного размера с концентрическим расположением соединительнотканных волокон, характерным для фиброзных гранулём.\",\n            buttonImage: \"/dzi/images/Fibrosus_Peskar_10x-sc.webp\",\n            dzi: \"Fibrosus_Peskar_10x-sc.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  8 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"/annotations/Fibrosus_Peskar_10x-sc.json\",\n            previewAlt: \"Компрессионный препарат тканей пескаря с множественными округлыми фиброзными узловыми образованиями\",\n            pageUrl: \"/ru/microscope-collection/fibrosus_peskar_10x-sc/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Фиброзные узловые образования у пескаря"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/monodactil/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"monodactil.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Хвост Монодактила\",\n            description: \"Хвостовой плавник Монодактила. Обратите внимание на мягкие ткани и сегменты лучей.\",\n            buttonImage: \"/dzi/images/monodactil.webp\",\n            dzi: \"monodactil.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  25 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Хвостовой плавник монодактила: мягкие ткани и сегменты плавниковых лучей под микроскопом\",\n            pageUrl: \"/ru/microscope-collection/monodactil/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Хвост Монодактила"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/algaepano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"algaePano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Черная борода\",\n            description: \"Красные водоросли. Можно встретить на аквариумных растениях...\",\n            buttonImage: \"/dzi/images/algaePano.webp\",\n            dzi: \"algaePano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  0.9 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Нитчатые красные водоросли, образующие обрастания типа «чёрная борода» в аквариуме\",\n            pageUrl: \"/ru/microscope-collection/algaepano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Черная борода"},{"content":"","permalink":"https://fossamethod.ru/ru/video/hexamitids/","summary":"","title":"Что такое «много» гексамитид"},{"content":" Яркость 100% Контраст 100% — Загрузка панорамы… ⛶Во весь экран Сфотать Аннотации: Выкл ","permalink":"https://fossamethod.ru/ru/microscope-collection/eggsnematpano/","summary":"\u003cstyle\u003e\n \n.microscope-collection {\n    max-width: 1200px;\n    margin: 0 auto;\n    padding: 20px;\n    --specimen-card-bg: color-mix(in srgb, var(--entry, #ffffff) 90%, var(--secondary, #777777) 10%);\n    --specimen-preview-bg: color-mix(in srgb, var(--theme, #ffffff) 92%, var(--secondary, #777777) 8%);\n    --specimen-border: var(--border, #d8d8d8);\n    --specimen-fg: var(--primary, #222222);\n    --specimen-accent: #da695d;\n    --scope-control-axis: 26px;  \n}\n\n.scope-container {\n    width: 700px;\n    height: auto;\n    margin: 5px auto 50px auto;\n    position: relative;\n    min-height: 700px; \n}\n\n.specimen-info {\n    text-align: center;\n    margin-bottom: 20px;\n    padding: 0;\n}\n\n.specimen-name {\n    font-size: 24px;\n    font-weight: bold;\n    margin-bottom: 10px;\n}\n\n.specimen-description {\n    line-height: 1.6;\n    font-size: 16px;\n    max-width: 600px;\n    margin: 0 auto;\n}\n\n.collection-controls {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n}\n\n.collection-title {\n    text-align: center;\n    margin: 0;\n    padding-top: 5px;\n}\n\n.annotation-toggle-btn {\n    margin: 0 auto;\n    padding: 8px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n}\n\n.buttons-scroll-container {\n    max-height: 800px;\n    overflow-y: auto;\n    overflow-x: hidden;\n     \n    -webkit-overflow-scrolling: touch;\n    touch-action: pan-y;\n    padding: 5px 5px 14px;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: transparent;\n    scrollbar-width: thin;\n    scrollbar-color: var(--tertiary, #aaa) transparent;\n}\n\n.collection-buttons {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 14px;\n    align-items: stretch;\n}\n\n \n.microscope-collection .fossa-specimen-card {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n}\n\n.microscope-collection .fossa-specimen-card \u003e .specimen-btn {\n    height: auto;\n    flex: 1;\n}\n\n.microscope-collection .fossa-specimen-page-link {\n    display: block;\n    text-align: center;\n    padding: 5px 4px 7px;\n    color: var(--secondary, #777);\n    font-size: 11px;\n    line-height: 1.35;\n    text-decoration: underline;\n    text-underline-offset: 3px;\n    overflow-wrap: anywhere;\n}\n\n.specimen-btn {\n    width: 100%;\n    min-width: 0;\n    height: 100%;\n    padding: 0;\n    margin: 0;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    position: relative;\n    border: 1px solid var(--specimen-border);\n    border-radius: 12px;\n    background: var(--specimen-card-bg);\n    color: var(--specimen-fg);\n    font: inherit;\n    cursor: pointer;\n     \n    touch-action: pan-y;\n    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);\n    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;\n}\n\n.specimen-btn-image-container {\n    width: 100%;\n    aspect-ratio: 16 / 10;\n    flex: 0 0 auto;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    overflow: hidden;\n    background: var(--specimen-preview-bg);\n    border-bottom: 1px solid var(--specimen-border);\n}\n\n.specimen-btn-image {\n    display: block;\n    width: 100%;\n    height: 100%;\n    padding: 0;\n    object-fit: contain;  \n}\n\n.specimen-btn-text {\n    min-width: 0;\n    min-height: 54px;\n    flex: 1 0 auto;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--specimen-fg);\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.35;\n    text-align: center;\n    text-wrap: balance;\n    overflow-wrap: anywhere;\n}\n\n@media (hover: hover) {\n    .specimen-btn:hover {\n        border-color: var(--secondary, #888);\n        transform: translateY(-3px);\n        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);\n    }\n}\n\n.specimen-btn.active {\n    border-color: var(--specimen-accent);\n    box-shadow: inset 0 0 0 1px var(--specimen-accent), 0 3px 12px rgba(218, 105, 93, .15);\n}\n\n.specimen-btn.active .specimen-btn-text {\n    color: var(--specimen-fg);\n}\n\n.specimen-btn:focus-visible {\n    outline: 2px solid var(--specimen-accent);\n    outline-offset: 3px;\n}\n\n.scope-wrapper {\n    width: 100%;\n    height: 700px;\n    border-radius: 50%;\n    overflow: hidden;\n    position: relative;\n    background: black;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-touch-callout: none;\n    -webkit-tap-highlight-color: transparent;\n}\n\n.dzi-viewer {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    overflow: hidden;\n}\n\n.scope-loader {\n    position: absolute;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 10;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 15px;\n     \n    pointer-events: none;\n}\n\n.scope-loader * {\n    pointer-events: none;\n}\n\n.loader-spinner {\n    width: 40px;\n    height: 40px;\n    border: 4px solid rgba(255, 255, 255, 0.3);\n    border-top: 4px solid #fff;\n    border-radius: 50%;\n    animation: spin 1s linear infinite;\n}\n\n.loader-text {\n    color: white;\n    font-family: Arial, sans-serif;\n    font-size: 14px;\n    text-align: center;\n}\n\n \n.scope-tile-status {\n    position: absolute;\n    left: 50%;\n    bottom: 32px;\n    z-index: 30;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    max-width: calc(100% - 36px);\n    padding: 7px 12px;\n    border: 1px solid rgba(255, 255, 255, .18);\n    border-radius: 999px;\n    background: rgba(23, 27, 34, .88);\n    color: #fff;\n    font: 500 12px/1.3 system-ui, sans-serif;\n    white-space: nowrap;\n    box-shadow: 0 3px 12px rgba(0, 0, 0, .18);\n    pointer-events: none;\n    opacity: 0;\n    visibility: hidden;\n    transform: translate(-50%, 5px);\n    transition: opacity .2s ease, transform .2s ease, visibility .2s;\n}\n\n.scope-tile-status.is-visible {\n    opacity: 1;\n    visibility: visible;\n    transform: translate(-50%, 0);\n}\n\n.scope-tile-status-spinner {\n    width: 12px;\n    height: 12px;\n    flex: none;\n    border: 2px solid rgba(255, 255, 255, .3);\n    border-top-color: #fff;\n    border-radius: 50%;\n    animation: scope-tile-spin .8s linear infinite;\n}\n\n.scope-tile-status[data-state=\"complete\"] .scope-tile-status-spinner {\n    display: none;\n}\n\n@keyframes scope-tile-spin {\n    to { transform: rotate(360deg); }\n}\n\n@media (max-width: 480px) {\n    .scope-tile-status {\n        bottom: 18px;\n        padding: 5px 9px;\n        font-size: 11px;\n    }\n}\n\n@media (prefers-reduced-motion: reduce) {\n    .scope-tile-status-spinner { animation: none; }\n    .scope-tile-status { transition: none; }\n}\n\n@keyframes spin {\n    0% { transform: translate(-50%, -50%) rotate(0deg); }\n    100% { transform: translate(-50%, -50%) rotate(360deg); }\n}\n\n.scope-aberration {\n    position: absolute;\n    inset: -20px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 2;\n    mix-blend-mode: screen;\n    opacity: 0.8;\n}\n\n.scope-aberration::before {\n    content: \"\";\n    position: absolute;\n    inset: -15px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(255,0,0,0) 50%,\n        rgba(255,50,0,0.6) 60%,\n        rgba(255,0,0,0.9) 100%\n    );\n    transform: scale(1.1);\n    filter: blur(3px);\n}\n\n.scope-aberration::after {\n    content: \"\";\n    position: absolute;\n    inset: 3px;\n    border-radius: 50%;\n    background: radial-gradient(circle at center,\n        rgba(0,0,255,0) 50%,\n        rgba(0,100,255,0.6) 90%,\n        rgba(0,0,255,0.9) 90%\n    );\n    transform: scale(0.95);\n    filter: blur(2px);\n}\n\n.scope-vignette {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    background: radial-gradient(circle at center,\n        rgba(0,0,0,0) 60%,\n        rgba(0,0,0,0.6) 80%,\n        rgba(0,0,0,0.9) 90%\n    );\n    z-index: 3;\n}\n\n.scope-with-glow {\n    position: relative;\n    width: 700px;\n    height: 700px;\n    margin: 0 auto;\n}\n\n.scope-glow {\n    position: absolute;\n    inset: -40px;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: -1;\n    background: \n        radial-gradient(circle at 40% 40%,\n            rgba(100, 200, 255, 0.6) 0%,\n            rgba(80, 180, 240, 0.4) 15%,\n            rgba(60, 160, 220, 0.2) 30%,\n            transparent 60%\n        ),\n        radial-gradient(circle at 60% 60%,\n            rgba(255, 220, 100, 0.5) 0%,\n            rgba(240, 200, 80, 0.3) 15%,\n            rgba(220, 180, 60, 0.1) 30%,\n            transparent 60%\n        );\n    filter: blur(35px);\n}\n\n.scope-glare {\n    position: absolute;\n    inset: 0;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 4;\n    background: radial-gradient(circle at 30% 30%,\n        rgba(255,255,255,0.1) 0%,\n        rgba(255,255,255,0) 50%\n    );\n    mix-blend-mode: overlay;\n}\n\n@media (max-width: 768px) {\n    .scope-container {\n        width: 95vw;\n        height: auto;\n        max-width: 500px;\n        max-height: none;\n        padding-right: 0;\n        min-height: auto;\n        margin: 5px auto 35px auto;\n    }\n\n    .specimen-info {\n        margin-bottom: 14px;\n    }\n\n    .specimen-name {\n        font-size: 20px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 14px;\n        line-height: 1.45;\n        max-width: 92vw;\n    }\n    \n    .scope-with-glow {\n        width: 95vw;\n        height: 95vw;\n        max-width: 500px;\n        max-height: 500px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n\n    .collection-controls {\n        margin-top: 20px;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 700px;\n    }\n    \n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 12px;\n    }\n}\n\n@media (max-width: 480px) {\n    .scope-container {\n        width: 90vw;\n        height: auto;\n        max-width: 400px;\n        max-height: none;\n        min-height: auto;\n        padding-right: 0;\n        margin-bottom: 30px;\n    }\n\n    .specimen-name {\n        font-size: 18px;\n        line-height: 1.25;\n    }\n\n    .specimen-description {\n        font-size: 13px;\n        line-height: 1.35;\n        max-width: 90vw;\n    }\n    \n    .scope-with-glow {\n        width: 90vw;\n        height: 90vw;\n        max-width: 400px;\n        max-height: 400px;\n    }\n    \n    .scope-wrapper {\n        height: 100%;\n        max-height: none;\n    }\n    \n    .buttons-scroll-container {\n        max-height: 480px;\n        padding: 4px 4px 12px;\n    }\n\n    .collection-buttons {\n        grid-template-columns: repeat(2, minmax(0, 1fr));\n        gap: 10px;\n    }\n\n    .specimen-btn-image-container {\n        aspect-ratio: 4 / 3;\n    }\n\n    .specimen-btn-text {\n        min-height: 58px;\n        padding: 8px 6px;\n        font-size: 12px;\n    }\n\n    .collection-title {\n        font-size: 22px;\n        margin-top: 5px;\n    }\n}\n\n\n.openseadragon-container .openseadragon-controls {\n    display: none !important;\n}\n\n.buttons-scroll-container::-webkit-scrollbar {\n    width: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-track {\n    background: transparent;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb {\n    background: var(--tertiary, #aaa);\n    border-radius: 8px;\n}\n\n.buttons-scroll-container::-webkit-scrollbar-thumb:hover {\n    background: var(--secondary, #888);\n}\n\n \n.lens-effect {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 5;\n    opacity: 0;\n}\n\n.lens-focus-in {\n    animation: focusIn 0.8s ease-out forwards;\n}\n\n.lens-focus-out {\n    animation: focusOut 0.6s ease-in forwards;\n}\n\n@keyframes focusIn {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 30%,\n            rgba(255, 255, 255, 0.3) 50%,\n            rgba(255, 255, 255, 0) 70%\n        );\n        transform: scale(0.8);\n        filter: blur(15px);\n    }\n    20% {\n        opacity: 1;\n        filter: blur(10px);\n    }\n    50% {\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0.1) 0%,\n            rgba(255, 255, 255, 0.3) 40%,\n            rgba(255, 255, 255, 0.5) 60%,\n            rgba(255, 255, 255, 0) 80%\n        );\n        filter: blur(5px);\n    }\n    80% {\n        opacity: 0.8;\n        filter: blur(2px);\n    }\n    100% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(255, 255, 255, 0) 0%,\n            rgba(255, 255, 255, 0.1) 20%,\n            rgba(255, 255, 255, 0.2) 40%,\n            rgba(255, 255, 255, 0) 60%\n        );\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes focusOut {\n    0% {\n        opacity: 0;\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.3) 0%,\n            rgba(0, 0, 0, 0.2) 30%,\n            rgba(0, 0, 0, 0.1) 50%,\n            rgba(0, 0, 0, 0) 70%\n        );\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    30% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    60% {\n        background: radial-gradient(\n            circle at center,\n            rgba(0, 0, 0, 0.4) 0%,\n            rgba(0, 0, 0, 0.3) 40%,\n            rgba(0, 0, 0, 0.1) 60%,\n            rgba(0, 0, 0, 0) 80%\n        );\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-chromatic {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 6;\n    opacity: 0;\n    mix-blend-mode: overlay;\n}\n\n.chromatic-in {\n    animation: chromaticIn 0.7s ease-out forwards;\n}\n\n.chromatic-out {\n    animation: chromaticOut 0.5s ease-in forwards;\n}\n\n@keyframes chromaticIn {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 45% 45%, rgba(255, 0, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 55% 55%, rgba(0, 255, 0, 0.3) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.3) 0%, transparent 50%);\n        transform: scale(0.9);\n        filter: blur(12px);\n    }\n    30% {\n        opacity: 0.8;\n        filter: blur(6px);\n    }\n    60% {\n        opacity: 0.6;\n        filter: blur(3px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(1.1);\n        filter: blur(0px);\n    }\n}\n\n@keyframes chromaticOut {\n    0% {\n        opacity: 0;\n        background: \n            radial-gradient(circle at 55% 55%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 45% 45%, rgba(0, 255, 0, 0.2) 0%, transparent 50%),\n            radial-gradient(circle at 50% 50%, rgba(0, 0, 255, 0.2) 0%, transparent 50%);\n        transform: scale(1.1);\n        filter: blur(5px);\n    }\n    40% {\n        opacity: 0.7;\n        filter: blur(8px);\n    }\n    80% {\n        opacity: 0.3;\n        filter: blur(12px);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.9);\n        filter: blur(15px);\n    }\n}\n\n.lens-flare {\n    position: absolute;\n    top: 20%;\n    left: 20%;\n    width: 30%;\n    height: 30%;\n    border-radius: 50%;\n    pointer-events: none;\n    z-index: 7;\n    opacity: 0;\n    background: radial-gradient(\n        ellipse at center,\n        rgba(255, 255, 255, 0.8) 0%,\n        rgba(255, 255, 255, 0.4) 30%,\n        rgba(255, 255, 255, 0) 70%\n    );\n}\n\n.flare-in {\n    animation: flareIn 0.8s ease-out forwards;\n}\n\n.flare-out {\n    animation: flareOut 0.6s ease-in forwards;\n}\n\n@keyframes flareIn {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.7;\n        transform: scale(1.2) rotate(90deg);\n    }\n    50% {\n        opacity: 0.4;\n        transform: scale(1) rotate(180deg);\n    }\n    75% {\n        opacity: 0.2;\n        transform: scale(0.8) rotate(270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(360deg);\n    }\n}\n\n@keyframes flareOut {\n    0% {\n        opacity: 0;\n        transform: scale(0.5) rotate(0deg);\n    }\n    25% {\n        opacity: 0.6;\n        transform: scale(1.1) rotate(-90deg);\n    }\n    50% {\n        opacity: 0.3;\n        transform: scale(0.9) rotate(-180deg);\n    }\n    75% {\n        opacity: 0.1;\n        transform: scale(0.7) rotate(-270deg);\n    }\n    100% {\n        opacity: 0;\n        transform: scale(0.5) rotate(-360deg);\n    }\n}\n\n\n.scale-bar {\n    position: absolute;\n    top: 80%;  \n    left: 50%;\n    transform: translateX(-50%);\n    text-align: center;\n    z-index: 12;\n    pointer-events: none;\n}\n\n \n.scale-bar-line {\n    width: 120px;  \n    height: 4px;\n    background: white;\n    border-radius: 2px;\n    margin: 6px auto 0 auto;\n    opacity: 0.85;\n}\n\n \n.scale-bar-text {\n    font-size: 16px;\n    color: white;\n    text-shadow: 0 0 6px black;\n    font-weight: 500;\n}\n\n\n\n \n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    z-index: 25;\n}\n\n.annotation-marker {\n    position: absolute;\n    width: 24px;\n    height: 24px;\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 0.8);\n    border-radius: 50%;\n    cursor: pointer;\n    pointer-events: all;\n    transform: translate(-50%, -50%);\n    transition: all 0.3s ease;\n    z-index: 26;\n    \n     \n    touch-action: none;\n    -webkit-user-drag: none;\n}\n\n.annotation-marker:hover {\n    background: transparent;\n    border: 2px solid rgba(255, 0, 0, 1);\n    transform: translate(-50%, -50%) scale(1.3);\n    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);\n     \n    pointer-events: auto;\n}\n\n.annotations-layer {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;  \n    z-index: 25;\n}\n\n\n.annotation-tooltip {\n    position: absolute;\n    background: rgba(0, 0, 0, 0.9);\n    color: white;\n    padding: 8px 12px;\n    border-radius: 6px;\n    font-size: 12px;\n    max-width: 200px;  \n    z-index: 27;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.3s ease;\n    border-left: 3px solid #ff3232;\n\n     \n    white-space: normal;   \n    word-wrap: break-word;  \n    overflow-wrap: break-word;  \n    box-sizing: border-box;  \n}\n\n\n.annotation-marker:hover + .annotation-tooltip {\n    opacity: 1;\n}\n\n \n.annotation-polygons {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    overflow: hidden;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon {\n    fill: none;\n    stroke-width: 2;\n    stroke-linejoin: round;\n    vector-effect: non-scaling-stroke;\n    pointer-events: none;\n}\n\n.annotation-polygons .annotation-polygon.is-hovered {\n    stroke-width: 3;\n}\n\n.annotation-polygon-tooltip.is-visible {\n    opacity: 1;\n}\n\n \n.scope-ruler-button { position:absolute; top:20px; left:calc(var(--scope-control-axis, 26px) - 38px); z-index:70; width:76px; height:76px; border:2px solid #73869a; border-radius:50%; padding:16px; display:grid; place-items:center; background:#151d28e6; color:#e4edf8; cursor:pointer; box-shadow:0 2px 8px #0005; }\n.scope-ruler-button svg { width:40px; height:40px; }\n.scope-ruler-button:hover, .scope-ruler-button[aria-pressed=\"true\"] { background:#284560; border-color:#8bbff4; }\n.scope-ruler-button:disabled { opacity:.45; cursor:default; }\n.scope-ruler-button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n.scope-measurement-panel { position:absolute; z-index:75; top:104px; left:calc(var(--scope-control-axis, 26px) - 60px); display:flex; justify-content:space-between; width:120px; padding:0; border:0; background:none; color:#e2e8f0; }\n.scope-measurement-panel[hidden] { display:none; }\n.scope-measurement-panel output { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }\n.scope-measurement-panel button { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:8px; border:1px solid #526c86; border-radius:50%; color:inherit; background:#34475bf2; cursor:pointer; }\n.scope-measurement-panel button svg { width:26px; height:26px; pointer-events:none; }\n.scope-measurement-panel button:hover { background:#284560; border-color:#8bbff4; }\n.scope-measurement-panel button:focus-visible { outline:2px solid #81b8ff; outline-offset:3px; }\n@media (max-width:700px) { .scope-measurement-panel { left:0; width:100px; } }\n.scope-measurement-overlay { position:absolute; inset:0; z-index:36; width:100%; height:100%; overflow:hidden; pointer-events:none; }\n.scope-measurement-overlay[hidden] { display:none; }\n.scope-measurement-overlay line { stroke:#fff; stroke-width:2; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #000); }\n.scope-measurement-overlay circle { fill:#163f60; stroke:#fff; stroke-width:2; cursor:move; pointer-events:all; }\n.scope-measurement-overlay circle:focus { fill:#4589c1; outline:none; stroke:#92d4ff; }\n.scope-measurement-overlay text { fill:white; stroke:#000; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; font:13px \"Segoe UI\",Arial,sans-serif; }\n.scope-wrapper.is-measuring .openseadragon-canvas { cursor:crosshair; }\n.scope-wrapper.is-measuring .annotations-layer, .scope-wrapper.is-measuring .annotation-marker { pointer-events:none; }\n \n.microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n    top: 20px;\n    right: calc(var(--scope-control-axis, 26px) - 38px);\n    width: 76px;\n    height: 76px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n    width: 76px;\n    height: 76px;\n    border-width: 2px;\n}\n.microscope-collection .scope-container .fossa-specimen-info-button \u003e svg {\n    width: 48px;\n    height: 48px;\n}\n.microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n    top: 84px;\n}\n\n \n.annotation-toggle-btn {\n    background: var(--entry, #f8f9fa);\n    border: 1px solid var(--border, #dee2e6);\n    padding: 8px 16px;\n    border-radius: 6px;\n    cursor: pointer;\n    font-size: 14px;\n    transition: all 0.3s ease;\n    margin: 0 auto 10px auto;\n    display: block;\n    color: var(--primary, #212529);\n    font-family: inherit;\n}\n\n.annotation-toggle-btn:hover {\n    background: var(--code-bg, #e9ecef);\n    border-color: var(--secondary, #adb5bd);\n    transform: translateY(-1px);\n}\n\n.annotation-toggle-btn.active {\n    background: #bd5147;\n    color: white;\n    border-color: #bd5147;\n    box-shadow: 0 2px 6px rgba(189, 81, 71, 0.22);\n}\n\n.annotation-toggle-btn:focus {\n    outline: 2px solid #bd5147;\n    outline-offset: 2px;\n}\n \n@media (max-width: 480px) {\n    .annotations-layer,\n    .annotation-marker,\n    .annotation-tooltip {\n        display: none !important;\n    }\n    \n    .annotation-toggle-btn {\n        display: none !important;\n    }\n}\n\n\n \n.microscope-collection--compact {\n    display: inline-block;\n    vertical-align: top;\n    box-sizing: border-box;\n    width: var(--fossa-compact-width, 48%);\n    max-width: 100%;\n    margin: 0 .45% 20px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-container {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    min-height: 0;\n    height: auto;\n    max-width: none;\n    margin: 0 auto 10px;\n    padding: 0;\n}\n\n.microscope-collection--compact .scope-with-glow {\n    box-sizing: border-box;\n    position: relative;\n    width: 100%;\n    height: auto;\n    aspect-ratio: 1 / 1;\n    max-width: none;\n    max-height: none;\n    margin: 0;\n}\n\n.microscope-collection--compact .scope-wrapper {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    min-height: 0;\n    max-height: none;\n}\n\n.microscope-collection--compact .scale-bar-line {\n    height: 2px;\n    border-radius: 1px;\n    margin-top: 3px;\n}\n\n.microscope-collection--compact .scale-bar-text {\n    font-size: clamp(10px, 1.15vw, 12px);\n    line-height: 1.2;\n}\n\n.microscope-collection--compact .scope-glow {\n    inset: -16px;\n    filter: blur(16px);\n    opacity: .75;\n}\n\n.microscope-collection--compact .scope-loader .loader-spinner {\n    width: 28px;\n    height: 28px;\n    border-width: 3px;\n}\n\n.microscope-collection--compact .scope-loader .loader-text {\n    font-size: 11px;\n}\n\n.microscope-collection--compact .annotation-toggle-btn {\n    padding: 5px 10px;\n    font-size: 12px;\n}\n\n.microscope-collection--compact .collection-controls {\n    margin: 0;\n}\n\n@media (max-width: 700px) {\n    .microscope-collection { --scope-control-axis: 33.5px; }  \n    .microscope-collection--modern { --scope-control-axis: 35.5px; }  \n    .microscope-collection--compact {\n        display: block;\n        width: min(100%, 480px);\n        max-width: 100%;\n        margin: 0 auto 22px;\n    }\n}\n\n\n \n@media (max-width: 700px) {\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button {\n        top: 10px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n        padding: 7px;\n        border-width: 1px;\n        box-sizing: border-box;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-ruler-button svg {\n        width: 20px;\n        height: 20px;\n    }\n\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control {\n        top: 10px;\n        right: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 38px;\n        height: 38px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button {\n        width: 38px;\n        height: 38px;\n        padding: 0;\n        border-width: 1px;\n    }\n    .microscope-collection .scope-container .scope-with-glow \u003e .fossa-specimen-info-control \u003e .fossa-specimen-info-button \u003e svg {\n        width: 24px;\n        height: 24px;\n    }\n\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel {\n        top: 54px;\n        left: calc(var(--scope-control-axis, 33.5px) - 38px);\n        width: 76px;\n        gap: 4px;\n        justify-content: flex-start;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button {\n        flex: 0 0 34px;\n        width: 34px;\n        height: 34px;\n        padding: 5px;\n    }\n    .microscope-collection .scope-with-glow \u003e .scope-measurement-panel button svg {\n        width: 20px;\n        height: 20px;\n    }\n    .microscope-collection .scope-container .scope-with-glow .fossa-specimen-info-panel {\n        top: 50px;\n    }\n}\n\n\u003c/style\u003e\n\n\n\u003clink rel=\"stylesheet\" href=\"/css/fossa-microscope-modern.css\"\u003e\n\u003cscript defer src=\"/js/fossa-microscope-modern.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"microscope-collection microscope-collection--modern\"\n     id=\"collection-0\"\u003e\n    \u003cdiv class=\"scope-container\"\u003e\n        \n        \u003cdiv class=\"specimen-info specimen-info--single\"\u003e\n          \u003cdiv class=\"specimen-name\" id=\"specimen-name-0\" style=\"display:none\"\u003e\u003c/div\u003e\n          \u003cdiv class=\"specimen-description\" id=\"specimen-desc-0\" style=\"display:none\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \n\n        \u003cdiv class=\"scope-with-glow\"\u003e\n\n    \u003cdiv class=\"scope-adjust\"  role=\"group\"\n         aria-label=\"Настройки изображения\"\u003e\n      \u003cdiv class=\"scope-knob scope-knob--brightness\" data-control=\"brightness\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"70\" aria-valuemax=\"130\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Яркость\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eЯркость\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"scope-knob scope-knob--contrast\" data-control=\"contrast\" tabindex=\"0\"\n           role=\"slider\" aria-valuemin=\"40\" aria-valuemax=\"200\" aria-valuenow=\"100\"\n           aria-valuetext=\"100%\" aria-label=\"Контраст\"\n           title=\"Колесо мыши или поворот ручки; нажмите на центр для сброса\"\u003e\n        \u003csvg class=\"scope-knob__dial\" viewBox=\"0 0 120 110\" aria-hidden=\"true\"\u003e\n          \u003cpath class=\"scope-knob__arc\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003cpath class=\"scope-knob__arc-mark\" d=\"M12 68 A48 48 0 0 1 108 68\" /\u003e\n          \u003ccircle class=\"scope-knob__inner\" cx=\"60\" cy=\"68\" r=\"30\" /\u003e\n          \u003cg class=\"scope-knob__needle\"\u003e\n            \u003cpath d=\"M60 68 L60 42\" /\u003e\n          \u003c/g\u003e\n          \u003ccircle class=\"scope-knob__center\" cx=\"60\" cy=\"68\" r=\"3\" /\u003e\n        \u003c/svg\u003e\n        \u003cspan class=\"scope-knob__info\"\u003e\n          \u003cspan\u003eКонтраст\u003c/span\u003e\n          \u003coutput\u003e100%\u003c/output\u003e\n        \u003c/span\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"fossa-specimen-info-control\"\u003e\n      \u003cbutton type=\"button\" class=\"fossa-specimen-info-button\"\n              aria-label=\"Описание препарата\"\n              title=\"Показать описание препарата\"\n              aria-expanded=\"false\" aria-controls=\"fossa-specimen-info-panel-0\"\u003e\n        \u003csvg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\"\n             stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\n          \u003ccircle cx=\"12\" cy=\"12\" r=\"9.25\"/\u003e\n          \u003ccircle cx=\"12\" cy=\"7.7\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\"/\u003e\n          \u003cpath d=\"M12 11v5.5\"/\u003e\n        \u003c/svg\u003e\n      \u003c/button\u003e\n      \u003cdiv class=\"fossa-specimen-info-panel\" id=\"fossa-specimen-info-panel-0\"\n           role=\"region\" aria-label=\"Описание препарата\"\u003e\n        \u003cdiv class=\"fossa-specimen-info-panel__text\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n            \u003cdiv class=\"scope-glow\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"scope-wrapper\" id=\"scope-0\"\u003e\n                \u003cdiv class=\"scale-bar\" id=\"scale-bar-0\"\u003e\n                    \u003cdiv class=\"scale-bar-line\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"scale-bar-text\" id=\"scale-bar-text-0\"\u003e—\u003c/div\u003e\n                \u003c/div\u003e\n\n\t\t\t\u003cdiv class=\"annotations-layer\" id=\"annotations-0\"\u003e\u003c/div\u003e\n\n\n                \u003cdiv id=\"dzi-viewer-0\" class=\"dzi-viewer\"\u003e\u003c/div\u003e\n                \n                \n                \u003cdiv class=\"lens-effect\" id=\"lens-effect-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-chromatic\" id=\"lens-chromatic-0\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"lens-flare\" id=\"lens-flare-0\"\u003e\u003c/div\u003e\n                \n                               \n                \n                \u003cdiv class=\"scope-loader\" id=\"loader-0\"\u003e\n                    \u003cdiv class=\"loader-spinner\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"loader-text\" id=\"loader-text-0\"\u003eЗагрузка панорамы…\u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"scope-aberration\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-glare\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-vignette\"\u003e\u003c/div\u003e\n                \u003cdiv class=\"scope-tile-status\" id=\"tile-status-0\"\n                     role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n                     data-text-loading=\"Загрузка деталей…\"\n                     data-text-complete=\"Загружено\"\u003e\n                    \u003cspan class=\"scope-tile-status-spinner\" aria-hidden=\"true\"\u003e\u003c/span\u003e\n                    \u003cspan class=\"scope-tile-status-text\"\u003e\u003c/span\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class=\"scope-photo-actions\"\u003e\n          \u003cbutton type=\"button\" class=\"fossa-shortcode-fullscreen\"\n            aria-pressed=\"false\"\n            data-enter=\"Во весь экран\"\n            data-exit=\"Свернуть\"\u003e\n            \u003cspan aria-hidden=\"true\"\u003e⛶\u003c/span\u003e\u003cspan class=\"fossa-shortcode-fullscreen-text\"\u003eВо весь экран\u003c/span\u003e\n          \u003c/button\u003e\n    \u003cbutton type=\"button\" class=\"scope-photo-button\"\n      title=\"Сохранить текущее поле зрения с масштабной линейкой в PNG\"\n      aria-label=\"Сфотать препарат\"\u003e\n      \u003csvg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\n        \u003cpath d=\"M4 7h4l2-3h4l2 3h4a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z\"/\u003e\n        \u003ccircle cx=\"12\" cy=\"13\" r=\"3.5\"/\u003e\n      \u003c/svg\u003e\n      \u003cspan\u003eСфотать\u003c/span\u003e\n    \u003c/button\u003e\n        \u003c/div\u003e\n        \n    \u003c/div\u003e\n\n\u003cdiv class=\"collection-controls\"\u003e\n\n    \u003cbutton id=\"toggle-annotations-0\" \n            class=\"annotation-toggle-btn\"\n            data-text-off=\"Аннотации: Выкл\"\n            data-text-on=\"Аннотации: Вкл\"\u003e\n        Аннотации: Выкл\n    \u003c/button\u003e\n\n    \n    \u003cdiv class=\"collection-buttons\" id=\"specimen-buttons-0\" style=\"display:none\"\u003e\u003c/div\u003e\n    \n\u003c/div\u003e\n\n\u003c/div\u003e\n\n\n\n\n\n\n\n\n\n\u003cscript\u003e\n(function () {\n    if (typeof window.OpenSeadragon !== 'undefined') {\n        return;\n    }\n\n    if (document.querySelector('script[data-fossa-openseadragon]')) {\n        return;\n    }\n\n    const script = document.createElement('script');\n    script.src = 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.1/openseadragon.min.js';\n    script.async = true;\n    script.dataset.fossaOpenseadragon = 'true';\n\n    script.addEventListener('load', function () {\n        console.log('YYYYY');\n    });\n\n    script.addEventListener('error', function () {\n        console.error('Не удалось загрузить OpenSeadragon:', script.src);\n    });\n\n    document.head.appendChild(script);\n})();\n\u003c/script\u003e\n\n\u003cscript\u003e\n(function() {\n    const id = \"0\";\n    const shortcodeSlide = \"eggsNematPano.dzi\";\n    const singleMode = true;\n    const compactMode = false;\n    const loader = document.getElementById(\"loader-\" + id);\n    const loaderText = document.getElementById(\"loader-text-\" + id);\n    const tileStatus = document.getElementById(\"tile-status-\" + id);\n    const tileStatusText = tileStatus ? tileStatus.querySelector('.scope-tile-status-text') : null;\n    const specimenName = document.getElementById(\"specimen-name-\" + id);\n    const specimenDesc = document.getElementById(\"specimen-desc-\" + id);\n    const specimenButtons = document.getElementById(\"specimen-buttons-\" + id);\n    const viewerContainer = document.getElementById(\"dzi-viewer-\" + id);\n    const lensEffect = document.getElementById(\"lens-effect-\" + id);\n    const lensChromatic = document.getElementById(\"lens-chromatic-\" + id);\n    const lensFlare = document.getElementById(\"lens-flare-\" + id);\n    \n    let currentAnnotations = [];\n    let showAnnotations = false;\n    let annotationDisposers = [];\n    \n    const specimens = [\n        \n        {\n            id:  0 ,\n            name: \"Яйца нематод\",\n            description: \"Яйца капилярий из кишечника данио.\",\n            buttonImage: \"/dzi/images/eggsNematPano.webp\",\n            dzi: \"eggsNematPano.dzi\",\n            unit: \"µm\",\n            microns_per_pixel:  1.6 ,\n            image_microns_per_pixel:  0 ,\n            calibration_unit: \"\",\n            roi_file: \"\",\n            previewAlt: \"Яйца нематод, предположительно капиллярий, из кишечника данио под микроскопом\",\n            pageUrl: \"/ru/microscope-collection/eggsnematpano/\"\n        }\n        \n    ];\n\n    let viewer = null;\n    \n    let compactLastWidth = 0;\n    let currentSpecimen = null;\n    let isTransitioning = false;\n    let currentZoomLevel = 1;\n    let lastZoomLevel = 1;\n    let zoomLevelTimeout = null;\n\n    \n    \n    let firstTileDrawn = false;\n    let tilesPending = false;\n    let tileShowTimer = null;\n    let tileHideTimer = null;\n    let firstTileFallbackTimer = null;\n\n    function resetTileStatus() {\n        clearTimeout(tileShowTimer);\n        clearTimeout(tileHideTimer);\n        clearTimeout(firstTileFallbackTimer);\n        tileShowTimer = null;\n        tileHideTimer = null;\n        firstTileFallbackTimer = null;\n        tilesPending = false;\n        firstTileDrawn = false;\n        if (tileStatus) {\n            tileStatus.classList.remove('is-visible');\n            tileStatus.dataset.state = '';\n        }\n    }\n\n    function updateTileStatus(fullyLoaded) {\n        if (!tileStatus || !tileStatusText || !firstTileDrawn) return;\n\n        if (!fullyLoaded) {\n            tilesPending = true;\n            clearTimeout(tileHideTimer);\n            tileHideTimer = null;\n            if (tileStatus.dataset.state === 'loading') return;\n\n            \n            tileStatus.classList.remove('is-visible');\n            clearTimeout(tileShowTimer);\n            tileShowTimer = setTimeout(() =\u003e {\n                if (!tilesPending || !firstTileDrawn) return;\n                tileStatus.dataset.state = 'loading';\n                tileStatusText.textContent = tileStatus.dataset.textLoading;\n                tileStatus.classList.add('is-visible');\n            }, 160);\n            return;\n        }\n\n        if (!tilesPending) return;\n        tilesPending = false;\n        clearTimeout(tileShowTimer);\n        tileShowTimer = null;\n        if (tileStatus.dataset.state !== 'loading') return;\n\n        tileStatus.dataset.state = 'complete';\n        tileStatusText.textContent = tileStatus.dataset.textComplete;\n        tileStatus.classList.add('is-visible');\n        clearTimeout(tileHideTimer);\n        tileHideTimer = setTimeout(() =\u003e {\n            tileStatus.classList.remove('is-visible');\n        }, 1100);\n    }\n\n   \n\nfunction updateAnnotationButtonText() {\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    if (button) {\n        const textOff = button.dataset.textOff || 'Annotations: Off';\n        const textOn = button.dataset.textOn || 'Annotations: On';\n        \n        button.textContent = showAnnotations ? textOn : textOff;\n    }\n}\n\n\n\n\nasync function loadAnnotations(roiFilePath) {\n  \n    \n    if (!roiFilePath || roiFilePath === '\"\"' || roiFilePath === '') {\n        console.log('Путь к аннотациям пустой или не указан');\n        currentAnnotations = [];\n        return;\n    }\n    \n    try {\n\n        const cleanPath = roiFilePath.replace(/^\"|\"$/g, ''); \n        const fullPath = cleanPath.startsWith('http') ? cleanPath : window.location.origin + cleanPath;\n  \n        \n \n        const response = await fetch(fullPath);\n       \n        \n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        \n\t\tconst data = await response.json();\n        \n        if (Array.isArray(data)) {\n            \n            currentAnnotations = data;\n        } else if (typeof data === 'object' \u0026\u0026 data !== null) {\n            \n            currentAnnotations = [data];\n        } else {\n            currentAnnotations = [];\n        }\n        \n\n        currentAnnotations.forEach((group, index) =\u003e {\n            console.log(`   Группа ${index}: ${group.id}, точек: ${group.points?.length || 0}`);\n        });\n        \n        if (showAnnotations \u0026\u0026 currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            console.log('Аннотации не показываем (showAnnotations:', showAnnotations, 'групп:', currentAnnotations.length, ')');\n        }\n        \n    } catch (error) {\n        currentAnnotations = [];\n    }\n}\n\n\nfunction originalMicronsPerPixel(specimen, imageWidth) {\n  const direct = Number(specimen?.image_microns_per_pixel);\n  if (Number.isFinite(direct) \u0026\u0026 direct \u003e 0) return direct;\n  const legacy = Number(specimen?.microns_per_pixel);\n  return Number.isFinite(legacy) \u0026\u0026 legacy \u003e 0 \u0026\u0026 Number.isFinite(imageWidth) \u0026\u0026 imageWidth \u003e 0\n    ? legacy * 700 * (149 / 154) / imageWidth : null;\n}\n\nfunction measureSegment(start, end, specimen, imageWidth) {\n  const pixels = Math.hypot(end.x - start.x, end.y - start.y);\n  const scale = originalMicronsPerPixel(specimen, imageWidth);\n  return { pixels, microns: scale === null ? null : pixels * scale };\n}\n\nfunction formatMeasurement(measurement, preferredUnit = '', missingScaleText = 'масштаб не задан') {\n  if (measurement.microns === null) return `${Number(measurement.pixels.toFixed(2))} px · ${missingScaleText}`;\n  const mm = preferredUnit === 'mm' || (!preferredUnit \u0026\u0026 measurement.microns \u003e= 1000);\n  return `${Number((measurement.microns / (mm ? 1000 : 1)).toPrecision(5))} ${mm ? 'mm' : 'µm'}`;\n}\n\n\n\n\nfunction bindImagePointDrag({ element, viewer, blocked, move, click }) {\n  let drag = null;\n  let suppressClick = false;\n  const press = event =\u003e {\n    if (blocked() || event.button !== 0) return;\n    event.preventDefault();\n    event.stopPropagation();\n    const rect = element.getBoundingClientRect();\n    suppressClick = false;\n    drag = {\n      id: event.pointerId, x: event.clientX, y: event.clientY,\n      offsetX: event.clientX - rect.left - rect.width / 2,\n      offsetY: event.clientY - rect.top - rect.height / 2,\n      navigation: viewer.isMouseNavEnabled(), moved: false,\n    };\n    viewer.setMouseNavEnabled(false);\n    element.setPointerCapture(event.pointerId);\n  };\n  const update = event =\u003e {\n    if (!drag || event.pointerId !== drag.id || blocked()) return;\n    event.preventDefault();\n    event.stopPropagation();\n    if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) \u003e 2) drag.moved = true;\n    if (!drag.moved) return;\n    const rect = viewer.element.getBoundingClientRect();\n    move({ x: event.clientX - rect.left - drag.offsetX, y: event.clientY - rect.top - drag.offsetY });\n  };\n  const release = event =\u003e {\n    if (!drag || (event \u0026\u0026 event.pointerId !== drag.id)) return;\n    event?.stopPropagation();\n    const previous = drag;\n    drag = null;\n    suppressClick = previous.moved;\n    if (element.hasPointerCapture(previous.id)) element.releasePointerCapture(previous.id);\n    viewer.setMouseNavEnabled(previous.navigation \u0026\u0026 !blocked());\n  };\n  const activate = event =\u003e {\n    event.preventDefault();\n    event.stopPropagation();\n    if (!blocked() \u0026\u0026 !suppressClick) click();\n    suppressClick = false;\n  };\n  element.addEventListener('pointerdown', press);\n  element.addEventListener('pointermove', update);\n  element.addEventListener('click', activate);\n  for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.addEventListener(name, release);\n  return { destroy() {\n    release();\n    element.removeEventListener('pointerdown', press);\n    element.removeEventListener('pointermove', update);\n    element.removeEventListener('click', activate);\n    for (const name of ['pointerup', 'pointercancel', 'lostpointercapture']) element.removeEventListener(name, release);\n  } };\n}\n\nfunction installMeasurementTool({ viewer, getSpecimen }) {\n  const russian = true;\n  const text = russian ? {\n    title: 'Измерить расстояние', name: 'Измерительная линейка',\n    prompt: 'Протяни линию по изображению.',\n    newLine: 'Новая линия', close: 'Убрать',\n    start: 'Начало измерения', end: 'Конец измерения', missingScale: 'масштаб не задан'\n  } : {\n    title: 'Measure distance', name: 'Measurement ruler',\n    prompt: 'Drag a line across the image.',\n    newLine: 'New line', close: 'Hide',\n    start: 'Start of measurement', end: 'End of measurement', missingScale: 'scale not set'\n  };\n  const container = viewer.element;\n  const lens = container.closest('.scope-with-glow');\n  const wrapper = container.closest('.scope-wrapper');\n  const button = document.createElement('button');\n  button.type = 'button';\n  button.className = 'scope-ruler-button';\n  button.title = text.title;\n  button.setAttribute('aria-label', text.name);\n  button.setAttribute('aria-pressed', 'false');\n  button.innerHTML = '\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m3 16 13-13 5 5L8 21z\"/\u003e\u003cpath d=\"m7 12 2 2m2-6 2 2m2-6 2 2\"/\u003e\u003c/svg\u003e';\n  const panel = document.createElement('div');\n  panel.className = 'scope-measurement-panel';\n  panel.setAttribute('role', 'group');\n  panel.setAttribute('aria-label', text.name);\n  panel.hidden = true;\n  panel.innerHTML = '\u003coutput aria-live=\"polite\"\u003e\u003c/output\u003e\u003cbutton type=\"button\" data-new\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"M20 11a8 8 0 1 0-2.3 6.7L21 14\"/\u003e\u003cpath d=\"M21 20v-6h-6\"/\u003e\u003c/svg\u003e\u003c/button\u003e\u003cbutton type=\"button\" data-close\u003e\u003csvg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\"\u003e\u003cpath d=\"m5 5 14 14M19 5 5 19\"/\u003e\u003c/svg\u003e\u003c/button\u003e';\n  panel.querySelector('output').textContent = text.prompt;\n  for (const [selector, label] of [['[data-new]', text.newLine], ['[data-close]', text.close]]) {\n    const action = panel.querySelector(selector);\n    action.title = label;\n    action.setAttribute('aria-label', label);\n  }\n  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n  svg.classList.add('scope-measurement-overlay');\n  svg.innerHTML = '\u003cline/\u003e\u003ccircle r=\"7\" data-endpoint=\"start\" tabindex=\"0\" role=\"button\" aria-label=\"Начало измерения\"/\u003e\u003ccircle r=\"7\" data-endpoint=\"end\" tabindex=\"0\" role=\"button\" aria-label=\"Конец измерения\"/\u003e\u003ctext/\u003e';\n  svg.querySelector('[data-endpoint=\"start\"]').setAttribute('aria-label', text.start);\n  svg.querySelector('[data-endpoint=\"end\"]').setAttribute('aria-label', text.end);\n  svg.setAttribute('hidden', '');\n  wrapper.append(svg);\n  lens.append(button, panel);\n  const output = panel.querySelector('output');\n  const line = svg.querySelector('line');\n  const label = svg.querySelector('text');\n  const handles = [...svg.querySelectorAll('circle')];\n  let active = false;\n  let drawing = false;\n  let dragging = false;\n  let segment = null;\n  let navigation = [];\n  let labelText = '';\n\n  function setDrawing(value) {\n    if (value === drawing) return;\n    drawing = value;\n    const settings = [viewer.gestureSettingsMouse, viewer.gestureSettingsTouch, viewer.gestureSettingsPen];\n    if (drawing) { navigation = settings.map(s =\u003e s.dragToPan); settings.forEach(s =\u003e { s.dragToPan = false; }); }\n    else settings.forEach((s, i) =\u003e { s.dragToPan = navigation[i]; });\n    wrapper.classList.toggle('is-measuring', drawing);\n  }\n  function pointAt(pixel, clamp = false) {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return null;\n    const size = item.getContentSize();\n    const p = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    if (!clamp \u0026\u0026 (p.x \u003c 0 || p.y \u003c 0 || p.x \u003e size.x || p.y \u003e size.y)) return null;\n    return { x: Math.max(0, Math.min(size.x, p.x)), y: Math.max(0, Math.min(size.y, p.y)) };\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    svg.toggleAttribute('hidden', !active || !segment || !item);\n    if (svg.hasAttribute('hidden')) return;\n    const project = point =\u003e viewer.viewport.pixelFromPoint(item.imageToViewportCoordinates(point.x, point.y, true), true);\n    const start = project(segment.start), end = project(segment.end);\n    line.setAttribute('x1', start.x); line.setAttribute('y1', start.y);\n    line.setAttribute('x2', end.x); line.setAttribute('y2', end.y);\n    handles.forEach((handle, i) =\u003e {\n      const point = i ? end : start;\n      handle.setAttribute('cx', point.x); handle.setAttribute('cy', point.y);\n      handle.style.pointerEvents = drawing ? 'none' : 'all';\n    });\n    const specimen = getSpecimen();\n    labelText = formatMeasurement(measureSegment(segment.start, segment.end, specimen, item.getContentSize().x), specimen?.calibration_unit, text.missingScale);\n    output.textContent = labelText;\n    label.textContent = labelText;\n    label.setAttribute('x', (start.x + end.x) / 2);\n    label.setAttribute('y', (start.y + end.y) / 2 - 13);\n    label.setAttribute('text-anchor', 'middle');\n  }\n  function reset() {\n    segment = null;\n    svg.setAttribute('hidden', '');\n    output.textContent = text.prompt;\n    setDrawing(active);\n  }\n  function enable(value) {\n    active = value;\n    button.setAttribute('aria-pressed', String(value));\n    panel.hidden = !value;\n    if (value) reset();\n    else { setDrawing(false); segment = null; svg.setAttribute('hidden', ''); }\n  }\n  button.addEventListener('click', () =\u003e enable(!active));\n  panel.querySelector('[data-new]').addEventListener('click', reset);\n  panel.querySelector('[data-close]').addEventListener('click', () =\u003e enable(false));\n  viewer.addHandler('canvas-press', event =\u003e {\n    if (!drawing || event.originalEvent?.button \u003e 0) return;\n    const point = pointAt(event.position);\n    if (!point) return;\n    event.preventDefaultAction = true;\n    segment = { start: point, end: point };\n    dragging = true;\n    update();\n  });\n  viewer.addHandler('canvas-drag', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    segment.end = pointAt(event.position, true);\n    update();\n  });\n  viewer.addHandler('canvas-release', event =\u003e {\n    if (!drawing || !dragging) return;\n    event.preventDefaultAction = true;\n    dragging = false;\n    segment.end = pointAt(event.position, true);\n    setDrawing(false);\n    update();\n  });\n  for (const handle of handles) {\n    const key = handle.dataset.endpoint;\n    bindImagePointDrag({ element: handle, viewer, blocked: () =\u003e !active || drawing || !segment,\n      move: position =\u003e { segment[key] = pointAt(new OpenSeadragon.Point(position.x, position.y), true); update(); },\n      click: () =\u003e handle.focus(),\n    });\n    handle.addEventListener('keydown', event =\u003e {\n      if (!active || drawing || !segment) return;\n      const delta = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key];\n      if (!delta) return;\n      event.preventDefault(); event.stopPropagation();\n      const size = viewer.world.getItemAt(0).getContentSize(), step = event.shiftKey ? 10 : 1;\n      segment[key] = { x: Math.max(0, Math.min(size.x, segment[key].x + delta[0] * step)), y: Math.max(0, Math.min(size.y, segment[key].y + delta[1] * step)) };\n      update();\n    });\n  }\n  document.addEventListener('keydown', event =\u003e {\n    if (event.key === 'Escape' \u0026\u0026 active \u0026\u0026 !event.target.closest('input,textarea,select')) enable(false);\n  });\n  viewer.addHandler('open', () =\u003e { button.disabled = false; enable(false); });\n  viewer.addHandler('close', () =\u003e { button.disabled = true; enable(false); });\n  button.disabled = !viewer.world.getItemAt(0);\n  for (const name of ['animation', 'zoom', 'pan', 'resize']) viewer.addHandler(name, update);\n}\n\nconst EPS = 1e-12;\nconst cross = (a, b, c) =\u003e (b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x);\nconst onSegment = (point, a, b) =\u003e Math.abs(cross(a, b, point)) \u003c= EPS \u0026\u0026\n  point.x \u003e= Math.min(a.x,b.x)-EPS \u0026\u0026 point.x \u003c= Math.max(a.x,b.x)+EPS \u0026\u0026\n  point.y \u003e= Math.min(a.y,b.y)-EPS \u0026\u0026 point.y \u003c= Math.max(a.y,b.y)+EPS;\n\nfunction polygonArea(vertices) {\n  return Math.abs(vertices.reduce((sum, point, i) =\u003e {\n    const next = vertices[(i+1)%vertices.length];\n    return sum + point.x*next.y - next.x*point.y;\n  }, 0))/2;\n}\n\nfunction validPolygon(vertices) {\n  if (!Array.isArray(vertices) || vertices.length \u003c 3 || vertices.length \u003e 1000 ||\n      vertices.some(p =\u003e !p || !Number.isFinite(p.x) || !Number.isFinite(p.y) || p.x \u003c 0 || p.x \u003e 1 || p.y \u003c 0 || p.y \u003e 1) ||\n      polygonArea(vertices) \u003c= EPS) return false;\n  for (let i=0; i\u003cvertices.length; i++) {\n    const a = vertices[i], b = vertices[(i+1)%vertices.length];\n    if (Math.hypot(a.x-b.x, a.y-b.y) \u003c= EPS) return false;\n    for (let j=i+1; j\u003cvertices.length; j++) {\n      if (j === i+1 || (i === 0 \u0026\u0026 j === vertices.length-1)) continue;\n      const c = vertices[j], d = vertices[(j+1)%vertices.length];\n      const abC = cross(a,b,c), abD = cross(a,b,d), cdA = cross(c,d,a), cdB = cross(c,d,b);\n      if ((abC*abD \u003c -EPS*EPS \u0026\u0026 cdA*cdB \u003c -EPS*EPS) ||\n          onSegment(c,a,b) || onSegment(d,a,b) || onSegment(a,c,d) || onSegment(b,c,d)) return false;\n    }\n  }\n  return true;\n}\n\n\nfunction pointInPolygon(point, vertices) {\n  let inside = false;\n  for (let i=0, j=vertices.length-1; i\u003cvertices.length; j=i++) {\n    const a = vertices[j], b = vertices[i];\n    if (onSegment(point,a,b)) return true;\n    if ((a.y \u003e point.y) !== (b.y \u003e point.y) \u0026\u0026 point.x \u003c (b.x-a.x)*(point.y-a.y)/(b.y-a.y)+a.x) inside = !inside;\n  }\n  return inside;\n}\n\nconst NS = 'http://www.w3.org/2000/svg';\n\n\n\nfunction renderPolygonAnnotations({ viewer, container, layer, groups }) {\n  const svg = document.createElementNS(NS, 'svg');\n  svg.classList.add('annotation-polygons');\n  svg.setAttribute('aria-hidden', 'true');\n  const regions = [];\n  for (const group of groups) {\n    for (const vertices of Array.isArray(group.polygons) ? group.polygons : []) {\n      if (!validPolygon(vertices)) continue;\n      const polygon = document.createElementNS(NS, 'polygon');\n      polygon.classList.add('annotation-polygon');\n      polygon.dataset.groupId = group.id;\n      polygon.style.stroke = group.color || '#ff4444';\n      svg.append(polygon);\n      const tooltip = document.createElement('div');\n      tooltip.className = 'annotation-tooltip annotation-polygon-tooltip';\n      tooltip.style.borderLeftColor = group.color || '#ff4444';\n      const lang = document.documentElement.lang || 'ru';\n      const heading = document.createElement('strong');\n      heading.textContent = group.labels?.[lang] || group.labels?.ru || group.label || 'Область';\n      const description = group.description?.[lang] || group.description?.ru ||\n        (typeof group.description === 'string' ? group.description : '');\n      tooltip.append(heading, document.createElement('br'), document.createTextNode(description));\n      regions.push({ vertices, polygon, tooltip });\n    }\n  }\n  if (!regions.length) return () =\u003e {};\n  layer.append(svg, ...regions.map(region =\u003e region.tooltip));\n  let pointer = null;\n  function hide() {\n    regions.forEach(region =\u003e {\n      region.tooltip.classList.remove('is-visible');\n      region.polygon.classList.remove('is-hovered');\n    });\n  }\n  function hover() {\n    hide();\n    const item = viewer.world.getItemAt(0);\n    if (!pointer || !item) return;\n    const rect = container.getBoundingClientRect();\n    const pixel = new OpenSeadragon.Point(pointer.x-rect.left, pointer.y-rect.top);\n    const image = item.viewportToImageCoordinates(viewer.viewport.pointFromPixel(pixel, true));\n    const size = item.getContentSize();\n    const point = { x: image.x/size.x, y: image.y/size.y };\n    const region = regions.findLast(candidate =\u003e pointInPolygon(point, candidate.vertices));\n    if (!region) return;\n    region.polygon.classList.add('is-hovered');\n    region.tooltip.classList.add('is-visible');\n    region.tooltip.style.left = Math.max(6, Math.min(pixel.x+14, rect.width-region.tooltip.offsetWidth-6))+'px';\n    region.tooltip.style.top = Math.max(6, Math.min(pixel.y+14, rect.height-region.tooltip.offsetHeight-6))+'px';\n  }\n  function update() {\n    const item = viewer.world.getItemAt(0);\n    if (!item) return;\n    const size = item.getContentSize();\n    for (const region of regions) {\n      region.polygon.setAttribute('points', region.vertices.map(point =\u003e {\n        const screen = viewer.viewport.viewportToViewerElementCoordinates(item.imageToViewportCoordinates(point.x*size.x, point.y*size.y));\n        return `${screen.x},${screen.y}`;\n      }).join(' '));\n    }\n    hover();\n  }\n  const move = event =\u003e { pointer = { x: event.clientX, y: event.clientY }; hover(); };\n  const leave = () =\u003e { pointer = null; hide(); };\n  container.addEventListener('pointermove', move);\n  container.addEventListener('pointerleave', leave);\n  const events = ['open', 'animation', 'zoom', 'pan', 'resize'];\n  events.forEach(name =\u003e viewer.addHandler(name, update));\n  update();\n  return () =\u003e {\n    container.removeEventListener('pointermove', move);\n    container.removeEventListener('pointerleave', leave);\n    events.forEach(name =\u003e viewer.removeHandler(name, update));\n    svg.remove();\n    regions.forEach(region =\u003e region.tooltip.remove());\n  };\n}\n\nfunction clearAnnotations() {\n    annotationDisposers.forEach(dispose =\u003e dispose());\n    annotationDisposers = [];\n    document.getElementById(`annotations-${id}`)?.replaceChildren();\n}\n\nfunction renderAnnotations() {\n        const annotationsLayer = document.getElementById(`annotations-${id}`);\n    \n    if (!annotationsLayer || !viewer) return;\n    if (!currentAnnotations.length) {\n        clearAnnotations();\n        return;\n    }\n\n    clearAnnotations();\n    annotationDisposers.push(renderPolygonAnnotations({\n        viewer, container: viewerContainer, layer: annotationsLayer, groups: currentAnnotations\n    }));\n\n    currentAnnotations.forEach((group, groupIndex) =\u003e {\n        if (!group.points || !Array.isArray(group.points)) return;\n\n        \n        const groupColor = group.color || '#ff4444';\n        \n\n        group.points.forEach((point, pointIndex) =\u003e {\n            const marker = document.createElement('div');\n            marker.className = 'annotation-marker';\n            marker.dataset.groupId = group.id;\n            marker.dataset.pointIndex = pointIndex;\n\n            \n            marker.style.borderColor = groupColor;\n            marker.style.boxShadow = `0 0 8px ${groupColor}80`; \n\n            const tooltip = document.createElement('div');\n            tooltip.className = 'annotation-tooltip';\n            tooltip.style.borderLeftColor = groupColor;             \n            const currentLang = document.documentElement.lang || 'ru';\n            const label = group.labels?.[currentLang] || group.labels?.ru || group.label || 'Объект';\n            const description = group.description?.[currentLang] || group.description?.ru || group.description || '';\n            \n            tooltip.innerHTML = `\n                \u003cstrong\u003e${label}\u003c/strong\u003e\u003cbr\u003e\n                ${description}\n            `;\n\n\nfunction updateMarkerPosition() {\n        \n    try {\n     \n        const tiledImage = viewer.world.getItemAt(0);\n        \n     \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        \n\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n      \n        const screenPoint = viewer.viewport.viewportToViewerElementCoordinates(viewportPoint);\n        \n\n        if (screenPoint \u0026\u0026 !isNaN(screenPoint.x) \u0026\u0026 !isNaN(screenPoint.y)) {\n            marker.style.left = screenPoint.x + 'px';\n            marker.style.top = screenPoint.y + 'px';\n            \n\n            tooltip.style.left = (screenPoint.x + 12) + 'px';\n            tooltip.style.top = (screenPoint.y + 12) + 'px';\n   \n            const zoom = viewer.viewport.getZoom();\n            const baseSize = 40;\n            const zoomFactor = Math.min(Math.max(zoom / 3, 0.3), 3); \n            const markerSize = baseSize * zoomFactor;\n            \n            marker.style.width = markerSize + 'px';\n            marker.style.height = markerSize + 'px';\n            marker.style.borderWidth = Math.max(1, 2 * zoomFactor) + 'px';\n        } else {\n            console.log('X', screenPoint);\n        }\n        \n    } catch (error) {\n        console.log('XX', error);\n    }\n}\n\n\nmarker.addEventListener('click', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n              \n        viewer.viewport.panTo(viewportPoint, true);\n        viewer.viewport.zoomTo(8, null, true);\n    }\n});\n\n\n\n\nlet touchStartZoom = 1;\nlet touchStartDistance = 0;\n\nmarker.addEventListener('touchstart', (e) =\u003e {\n    if (e.touches.length === 2) {\n        e.preventDefault();\n        e.stopPropagation();\n        \n        \n        touchStartZoom = viewer.viewport.getZoom();\n        touchStartDistance = Math.hypot(\n            e.touches[0].clientX - e.touches[1].clientX,\n            e.touches[0].clientY - e.touches[1].clientY\n        );\n    }\n}, { passive: false });\n\n\n\nmarker.addEventListener('wheel', (e) =\u003e {\n    e.preventDefault();\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    \n    if (viewer \u0026\u0026 viewer.viewport \u0026\u0026 viewer.world.getItemAt(0)) {\n        const tiledImage = viewer.world.getItemAt(0);\n        const viewport = viewer.viewport;\n        \n        const imagePoint = new OpenSeadragon.Point(\n            point.x * tiledImage.source.dimensions.x,\n            point.y * tiledImage.source.dimensions.y\n        );\n        const viewportPoint = tiledImage.imageToViewportCoordinates(imagePoint);\n        \n\n        const zoomFactor = e.deltaY \u003e 0 ? 0.9 : 1.1;\n        \n \n        \n \n        viewer.viewport.zoomBy(zoomFactor, viewportPoint);\n        \n \n        setTimeout(updateScaleBar, 100);\n    }\n}, { passive: false });\n\n\n\n\n         \n            marker.addEventListener('click', (e) =\u003e {\n                e.stopPropagation();\n                if (viewer) {\n                    viewer.viewport.panTo(\n                        new OpenSeadragon.Point(point.x, point.y),\n                        true\n                    );\n                    viewer.viewport.zoomTo(8);\n                }\n            });\n\n            annotationsLayer.appendChild(marker);\n            annotationsLayer.appendChild(tooltip);\n            \n            updateMarkerPosition();\n            \n \n            viewer.addHandler('zoom', updateMarkerPosition);\n            viewer.addHandler('pan', updateMarkerPosition);\n            viewer.addHandler('resize', updateMarkerPosition);\n            viewer.addHandler('animation', updateMarkerPosition);\n            annotationDisposers.push(() =\u003e {\n                ['zoom', 'pan', 'resize', 'animation'].forEach(name =\u003e {\n                    viewer.removeHandler(name, updateMarkerPosition);\n                });\n            });\n        });\n    });\n    \n\n}\n\n\n\n    function toggleAnnotations() {\n    showAnnotations = !showAnnotations;\n    const button = document.getElementById(`toggle-annotations-${id}`);\n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n\n  \n    updateAnnotationButtonText();\n\n    if (showAnnotations) {\n        button.classList.add('active');\n        if (currentAnnotations.length \u003e 0) {\n            renderAnnotations();\n        } else {\n            setTimeout(() =\u003e {\n                showAnnotations = false;\n                updateAnnotationButtonText();\n                button.classList.remove('active');\n            }, 1000);\n        }\n    } else {\n        button.classList.remove('active');\n        \n\n        if (viewer \u0026\u0026 annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n}\n\n\nfunction initialize() {\n    \n    if (typeof OpenSeadragon === 'undefined') {\n        console.log('OpenSeadragon еще не загружен, ждем...');\n        setTimeout(initialize, 100);\n        return;\n    }\n\n    initOpenSeadragon();\n    if (!singleMode) {\n        initSpecimenButtons();\n    }\n\n    const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n    \n    if (toggleBtn) {\n        showAnnotations = false;\n        updateAnnotationButtonText();\n        toggleBtn.classList.remove('active');\n        \n        toggleBtn.addEventListener('click', toggleAnnotations);\n    } else {\n        console.log('XXX');\n    }\n\n    let resizeTimeout;\n    window.addEventListener('resize', function() {\n        clearTimeout(resizeTimeout);\n        resizeTimeout = setTimeout(() =\u003e {\n            if (viewer \u0026\u0026 currentSpecimen) {\n                updateScaleBar();\n            }\n        }, 250);\n    });\n\n    if (specimens.length \u003e 0) {\n        setTimeout(() =\u003e loadSpecimen(0), 500);\n    }\n}\n\n\n\n\n\n\n\nfunction compactClampZoom(value) {\n    return Math.max(1, Math.min(50, value));\n}\n\nfunction applyCompactInitialZoom() {\n    if (!compactMode || !viewer || !viewer.viewport) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    compactLastWidth = width;\n    \n    \n    const zoom = viewer.viewport.getZoom(true);\n    const targetZoom = compactClampZoom(zoom * 700 / width);\n    viewer.viewport.zoomTo(targetZoom, null, true);\n    updateScaleBar();\n}\n\nfunction handleCompactResize() {\n    if (!compactMode || !viewer || !viewer.viewport || !currentSpecimen) return;\n    const width = viewerContainer.getBoundingClientRect().width;\n    if (!(width \u003e 0)) return;\n    if (compactLastWidth \u003e 0 \u0026\u0026 Math.abs(width - compactLastWidth) \u003e 0.5) {\n        \n        const previousWidth = compactLastWidth;\n        compactLastWidth = width;\n        const zoom = viewer.viewport.getZoom(true);\n        viewer.viewport.zoomTo(compactClampZoom(zoom * previousWidth / width), null, true);\n    } else {\n        compactLastWidth = width;\n    }\n    updateScaleBar();\n}\n\nfunction updateScaleBar() {\n    \n    \n    \n    \n    const REFERENCE_SCOPE_WIDTH = 700;\n    \n    \n    \n    \n    const GLOBAL_SCALE_CORRECTION = 149 / 154; \n    const barLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n    const barText = document.getElementById(`scale-bar-text-${id}`);\n    if (!barLine || !barText) return;\n\n    const hideBar = () =\u003e {\n        barLine.style.visibility = 'hidden';\n        barText.textContent = '—';\n    };\n\n    if (!viewer || !viewer.viewport || !viewer.world ||\n        !viewer.world.getItemAt(0) || !currentSpecimen) {\n        hideBar();\n        return;\n    }\n\n    const legacyMPP = Number(currentSpecimen.microns_per_pixel);\n    const imageMPP = Number(currentSpecimen.image_microns_per_pixel);\n    const scopeWidth = viewerContainer.getBoundingClientRect().width;\n    \n    const zoom = viewer.viewport.getZoom(true);\n\n    if ((!((legacyMPP \u003e 0) \u0026\u0026 Number.isFinite(legacyMPP)) \u0026\u0026\n         !((imageMPP \u003e 0) \u0026\u0026 Number.isFinite(imageMPP))) ||\n        !(scopeWidth \u003e 0) || !(zoom \u003e 0) ||\n        !Number.isFinite(scopeWidth) || !Number.isFinite(zoom)) {\n        hideBar();\n        return;\n    }\n\n    \n    \n    \n    \n    const micronsPerScreenPx =\n        imageMPP \u003e 0 \u0026\u0026 Number.isFinite(imageMPP)\n            ? imageMPP / viewer.world.getItemAt(0).viewportToImageZoom(zoom)\n            : (legacyMPP / zoom) * (REFERENCE_SCOPE_WIDTH / scopeWidth) * GLOBAL_SCALE_CORRECTION;\n\n    \n    \n    const maxWidthPx = scopeWidth * 0.30;\n    const maxMicrons = maxWidthPx * micronsPerScreenPx;\n    if (!(maxMicrons \u003e 0) || !Number.isFinite(maxMicrons)) {\n        hideBar();\n        return;\n    }\n\n    const power = Math.pow(10, Math.floor(Math.log10(maxMicrons)));\n    let shownMicrons = power;\n    for (const factor of [1, 2, 5, 10]) {\n        if (factor * power \u003c= maxMicrons) {\n            shownMicrons = factor * power;\n        }\n    }\n    const lineWidth = shownMicrons / micronsPerScreenPx;\n    if (!(lineWidth \u003e 0) || !Number.isFinite(lineWidth)) {\n        hideBar();\n        return;\n    }\n\n    barLine.style.width = `${lineWidth}px`;\n    barLine.style.visibility = 'visible';\n    const display = value =\u003e Number(value.toPrecision(5)).toString();\n    const inMillimeters = currentSpecimen.calibration_unit === 'mm' ||\n        (!currentSpecimen.calibration_unit \u0026\u0026 shownMicrons \u003e= 1000);\n    barText.textContent = inMillimeters\n        ? `${display(shownMicrons / 1000)} mm`\n        : `${display(shownMicrons)} µm`;\n}\n\n    function playLensEffect(isZoomIn) {\n        if (isTransitioning) return;\n        \n        isTransitioning = true;\n        \n        \n        lensEffect.className = 'lens-effect';\n        lensChromatic.className = 'lens-chromatic';\n        lensFlare.className = 'lens-flare';\n        \n        \n        setTimeout(() =\u003e {\n            \n            if (isZoomIn) {\n                lensEffect.classList.add('lens-focus-in');\n                lensChromatic.classList.add('chromatic-in');\n                lensFlare.classList.add('flare-in');\n            } else {\n                lensEffect.classList.add('lens-focus-out');\n                lensChromatic.classList.add('chromatic-out');\n                lensFlare.classList.add('flare-out');\n            }\n            \n            \n            \n            \n            setTimeout(() =\u003e {\n                isTransitioning = false;\n            }, 800);\n        }, 50);\n    }\n\n\n\n    function handleZoomChange(newZoom) {\n        lastZoomLevel = currentZoomLevel;\n        currentZoomLevel = newZoom;\n        \n        \n        const zoomThreshold = 0.2;\n        const zoomChange = Math.abs(newZoom - lastZoomLevel) / lastZoomLevel;\n        \n        if (zoomChange \u003e= zoomThreshold) {\n            const isZoomIn = newZoom \u003e lastZoomLevel;\n            playLensEffect(isZoomIn);\n        }\n        \n        \n        updateScaleBar();\n    }\n\n\n    function initOpenSeadragon() {\n        \n        if (!viewerContainer) {\n            console.error('Контейнер DZI viewer не найден');\n            return;\n        }\n\n        try {\n            viewer = OpenSeadragon({\n                id: \"dzi-viewer-\" + id,\n                prefixUrl: \"\",\n                showNavigator: false,\n                navigatorSizeRatio: 0.15,\n                showZoomControl: false,\n                showHomeControl: false,\n                showFullPageControl: false,\n                animationTime: 0.8,\n                blendTime: 0.3,\n                minZoomLevel: 1,\n                maxZoomLevel: 50,\n                gestureSettingsMouse: {\n                    scrollToZoom: true\n                },\n                useCanvas: true,\n                loadTilesWithAjax: false\n            });\n\n\n            installMeasurementTool({ viewer, getSpecimen: () =\u003e currentSpecimen });\n\n            \n            \n            viewer.world.addHandler('add-item', function(event) {\n                const tiledImage = event.item;\n                tiledImage.addHandler('fully-loaded-change', function(state) {\n                    if (viewer.world.getItemAt(0) !== tiledImage) return;\n                    updateTileStatus(state.fullyLoaded);\n                });\n            });\n\n            \n            \n            function onFirstTileReady(tiledImage) {\n                if (!tiledImage || tiledImage !== viewer.world.getItemAt(0) || firstTileDrawn) return;\n                firstTileDrawn = true;\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = null;\n                hideLoader();\n                updateTileStatus(tiledImage.getFullyLoaded());\n            }\n\n            viewer.addHandler('tile-loaded', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n            viewer.addHandler('tile-drawn', function(event) {\n                onFirstTileReady(event.tiledImage);\n            });\n\n            viewer.addHandler('open', function() {\n\n                \n                \n                const openedImage = viewer.world.getItemAt(0);\n                clearTimeout(firstTileFallbackTimer);\n                firstTileFallbackTimer = setTimeout(() =\u003e {\n                    onFirstTileReady(openedImage);\n                }, 1800);\n                \n                \n                currentZoomLevel = viewer.viewport.getZoom(true);\n                lastZoomLevel = currentZoomLevel;\n                if (typeof showZoomLevelIndicator === 'function') {\n                    showZoomLevelIndicator();\n                }\n                \n                \n                \n                applyCompactInitialZoom();\n\n                \n                setTimeout(updateScaleBar, 300);\n            });\n\n            \n            viewer.addHandler('zoom', function(event) {\n                const newZoom = event.zoom;\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('animation', updateScaleBar);\n\n            \n            viewer.addHandler('animation-finish', function(event) {\n                const newZoom = viewer.viewport.getZoom(true);\n                handleZoomChange(newZoom);\n            });\n\n            \n            viewer.addHandler('resize', function() {\n                handleCompactResize();\n                updateScaleBar();\n            });\n\n            viewer.addHandler('open-failed', function(event) {\n                console.error('Ошибка загрузки DZI:', event.message);\n                loaderText.textContent = 'Ошибка загрузки';\n                resetTileStatus();\n                setTimeout(hideLoader, 2000);\n                isTransitioning = false;\n            });\n\n        } catch (error) {\n            console.error('Ошибка инициализации OpenSeadragon:', error);\n            isTransitioning = false;\n        }\n    }\n\n\n    function initSpecimenButtons() {\n        specimens.forEach((specimen, index) =\u003e {\n            const button = document.createElement('button');\n            button.className = 'specimen-btn';\n            const imageHolder = document.createElement('div');\n            imageHolder.className = 'specimen-btn-image-container';\n            const image = document.createElement('img');\n            image.className = 'specimen-btn-image';\n            image.src = specimen.buttonImage;\n            image.alt = specimen.previewAlt || specimen.name;\n            image.onerror = () =\u003e { image.style.display = 'none'; };\n            imageHolder.appendChild(image);\n            const label = document.createElement('div');\n            label.className = 'specimen-btn-text';\n            label.textContent = specimen.name;\n            button.append(imageHolder, label);\n            button.dataset.specimenId = index;\n            \n            \n            \n            \n            button.addEventListener('click', () =\u003e {\n                loadSpecimen(index);\n            });\n\n            const card = document.createElement('div');\n            card.className = 'fossa-specimen-card';\n            card.appendChild(button);\n            if (specimen.pageUrl) {\n                const link = document.createElement('a');\n                link.className = 'fossa-specimen-page-link';\n                link.href = specimen.pageUrl;\n                link.textContent = 'Страница препарата';\n                link.setAttribute('aria-label', link.textContent + ': ' + specimen.name);\n                card.appendChild(link);\n            }\n            specimenButtons.appendChild(card);\n        });\n    }\n\n\nfunction normalizeSlideKey(value) {\n    return String(value || '')\n        .trim()\n        .replace(/^\\/+/, '')\n        .replace(/^dzi\\//i, '')\n        .replace(/\\.dzi$/i, '')\n        .toLowerCase();\n}\n\n\nfunction getSpecimenIdFromUrl() {\n    const params = new URLSearchParams(window.location.search);\n    \n    \n    const requestedSlide = shortcodeSlide || params.get('slide');\n\n    if (!requestedSlide) {\n        return 0;\n    }\n\n    const requestedKey = normalizeSlideKey(requestedSlide);\n\n    const specimenId = specimens.findIndex(specimen =\u003e\n        normalizeSlideKey(specimen.dzi) === requestedKey\n    );\n\n    if (specimenId \u003c 0) {\n        console.warn(\n            'Microscope slide not found:',\n            requestedSlide,\n            'available:',\n            specimens.map(s =\u003e normalizeSlideKey(s.dzi))\n        );\n        return 0;\n    }\n\n    return specimenId;\n}\n\n\nfunction updateSpecimenUrl(specimen) {\n    if (!specimen || !specimen.dzi) return;\n\n    \n    if (singleMode) return;\n\n    const url = new URL(window.location.href);\n\n    \n\n    url.searchParams.set(\n        'slide',\n        normalizeSlideKey(specimen.dzi)\n    );\n\n    window.history.replaceState(\n        { slide: specimen.dzi },\n        '',\n        url\n    );\n}\n\n\n\nfunction loadSpecimen(specimenId) {\n    const specimen = specimens[specimenId];\n    if (!specimen) return;\n\n\n    showAnnotations = false;\n    updateAnnotationButtonText();\nconst toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n\nif (toggleBtn) {\n    toggleBtn.classList.remove('active');\n\n    const hasAnnotations =\n        specimen.roi_file \u0026\u0026\n        specimen.roi_file !== '\"\"' \u0026\u0026\n        specimen.roi_file.trim() !== '';\n\n    toggleBtn.style.display = hasAnnotations ? 'block' : 'none';\n}\n\n    \n    const annotationsLayer = document.getElementById(`annotations-${id}`);\n    if (annotationsLayer) {\n        clearAnnotations();\n    }\n    currentAnnotations = [];\n\n    \n    document.querySelectorAll(`#specimen-buttons-${id} .specimen-btn`).forEach(btn =\u003e {\n        btn.classList.remove('active');\n    });\n    const activeButton = document.querySelector(`#specimen-buttons-${id} [data-specimen-id=\"${specimenId}\"]`);\n    if (activeButton) activeButton.classList.add('active');\n\n    \n    \n    \n    if (specimenName) {\n        specimenName.textContent = specimen.name;\n    }\n    if (specimenDesc) {\n        specimenDesc.textContent = specimen.description;\n    }\n\n    currentSpecimen = specimen;\n    updateSpecimenUrl(specimen);\n    \n    \n \n    \n    if (specimen.roi_file \u0026\u0026 specimen.roi_file !== '\"\"' \u0026\u0026 specimen.roi_file !== '') {\n        loadAnnotations(specimen.roi_file);\n    } else {\n\n        currentAnnotations = [];\n        if (annotationsLayer) {\n            clearAnnotations();\n        }\n    }\n    \n    \n    loadDZIPanorama(specimen.dzi);\n}\n\n\n    function loadDZIPanorama(dziFile) {\n        resetTileStatus();\n        \n        const oldScaleLine = document.querySelector(`#scale-bar-${id} .scale-bar-line`);\n        const oldScaleText = document.getElementById(`scale-bar-text-${id}`);\n        if (oldScaleLine) oldScaleLine.style.visibility = 'hidden';\n        if (oldScaleText) oldScaleText.textContent = '—';\n        loaderText.textContent = 'Загрузка панорамы…';\n        showLoader();\n\n        if (!viewer) {\n            console.error('OpenSeadragon viewer не инициализирован');\n            return;\n        }\n\n        const dziPath = \"/dzi/\" + dziFile;\n        viewer.open(dziPath);\n    }\n\n    function showLoader() {\n        loader.style.display = 'flex';\n    }\n\n    function hideLoader() {\n        loader.style.display = 'none';\n    }\n\n\n    function initialize() {\n\n        \n        if (typeof OpenSeadragon === 'undefined') {\n            setTimeout(initialize, 100);\n            return;\n        }\n\n        initOpenSeadragon();\n        if (compactMode \u0026\u0026 typeof ResizeObserver !== 'undefined') {\n            \n            \n            const compactResizeObserver = new ResizeObserver(() =\u003e {\n                requestAnimationFrame(handleCompactResize);\n            });\n            compactResizeObserver.observe(viewerContainer);\n        }\n        if (!singleMode) {\n            initSpecimenButtons();\n        }\n\n        const toggleBtn = document.getElementById(`toggle-annotations-${id}`);\n        \n        if (toggleBtn) {\n            toggleBtn.addEventListener('click', toggleAnnotations);\n            console.log('YYYYY');\n        } else {\n            console.log('XXXXX');\n        }\n\n        let resizeTimeout;\n        window.addEventListener('resize', function() {\n            clearTimeout(resizeTimeout);\n            resizeTimeout = setTimeout(() =\u003e {\n                if (viewer \u0026\u0026 currentSpecimen) {\n                    updateScaleBar();\n                }\n            }, 250);\n        });\n\nif (specimens.length \u003e 0) {\n    const initialSpecimenId = getSpecimenIdFromUrl();\n\n    setTimeout(() =\u003e {\n        loadSpecimen(initialSpecimenId);\n    }, 500);\n}\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initialize);\n    } else {\n        initialize();\n    }\n\n\n})();\n\u003c/script\u003e","title":"Яйца нематод"}]