* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 7px;
    height: 0;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, .3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1e40af, #3b82f6);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb, #60a5fa);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(15, 23, 42, .3);
}

html,
body {
    font-family: 'Exo 2', sans-serif;
    background: #0f172a;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.modal-active,
html.modal-active {
    overflow: hidden !important;
}

html.is-embed,
body.is-embed {
    overflow: hidden;
}

body.is-embed .canvas-scroll-wrapper {
    padding: 0 !important;
}

#app {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== ЗАГОЛОВОК ===== */
.nomenclature-title {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    text-align: center;
    pointer-events: none;
    padding: 14px 24px 20px;
    background: linear-gradient(180deg, rgba(15, 23, 42, .92) 0%, rgba(15, 23, 42, .5) 70%, transparent 100%);
    width: 100%;
}

.nomenclature-title h1 {
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
}

/* ===== CANVAS SCROLL WRAPPER ===== */
.canvas-scroll-wrapper {
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 8px 0 16px;
    overflow: visible;
}

/* ===== CANVAS OUTER ===== */
.canvas-outer {
    margin: auto;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

/* ===== CANVAS VIEW (основной холст: фон + не-маркеры) ===== */
.canvas-view {
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(0, 0, 0, .6);
    transform-origin: top left;
}

.canvas-view .bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== MARKERS LAYER (изолированный слой маркеров) ===== */
/* Брат .canvas-view, тот же transform, но clip-path вместо overflow:hidden.
   Это снимает конфликт GPU-слоёв маркеров с масштабированным родителем. */
.markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    overflow: visible;
    clip-path: inset(0);
    -webkit-clip-path: inset(0);
    transform-origin: top left;
    pointer-events: none;
    z-index: 2;
}

.markers-layer .v-comp--marker {
    pointer-events: auto;
}

/* ===== CANVAS EFFECTS LAYER ===== */
.canvas-effects-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ===== COMPONENTS ===== */
.v-comp {
    position: absolute;
    user-select: none;
}

/* ===== ТРЁХСЛОЙНАЯ СТРУКТУРА ЭФФЕКТОВ ===== */
.v-effect-outer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.v-effect-inner {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.v-effect-inner>* {
    pointer-events: auto;
}

/* ===== MARKER ===== */
.v-comp--marker .v-effect-inner {
    overflow: visible;
}

.v-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.v-marker--emoji {
    pointer-events: none;
}

.v-marker-emoji {
    display: inline-block;
    line-height: 1;
    pointer-events: auto;
}

/* Linked-маркер: анимируем КОНТЕЙНЕР целиком.
   will-change безопасен, т.к. родитель — .markers-layer (clip-path, а не overflow:hidden) */
.v-marker--linked {
    cursor: pointer;
    transition: transform .15s ease-out;
    will-change: transform;
}

.v-marker--linked:hover {
    transform: scale(1.25);
}

.v-marker-shape,
.v-marker-media {
    pointer-events: auto;
    width: 100%;
    height: 100%;
}

.v-marker-shape {
    display: flex;
    align-items: center;
    justify-content: center;
}

.v-marker-shape svg {
    display: block;
}

.v-marker-media {
    overflow: hidden;
    border-radius: 4px;
    position: relative;
}

.v-marker-media img,
.v-marker-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

/* ===== TITLE / TEXT ===== */
.v-title {
    font-weight: 700;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 4px 8px;
    line-height: 1.2;
}

.v-text {
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px;
    line-height: 1.2;
}

.v-title,
.v-text {
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: none;
}

/* ===== BUTTON ===== */
.v-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
    position: relative;
}

.v-button .btn-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.v-button .btn-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: #333;
    text-align: center;
    background: rgba(255, 255, 255, .85);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v-button .btn-inner {
    background: #3b82f6;
    color: #fff;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== BACK BUTTON ===== */
.v-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    width: 100%;
    height: 100%;
    justify-content: center;
    transition: filter .2s;
    overflow: hidden;
    white-space: nowrap;
}

.v-back-btn:hover {
    filter: brightness(0.95);
}

/* ===== GALLERY ===== */
.v-gallery {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    width: 100%;
    height: 100%;
}

.v-gallery>.gal-crop-wrap>img,
.v-gallery>.gal-crop-wrap>video {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.v-comp>.gal-caption {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 11px;
    background: rgba(0, 0, 0, .65);
    padding: 3px 6px;
    z-index: 4;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.v-comp>.gal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background .2s;
}

.v-comp>.gal-arrow:hover {
    background: rgba(0, 0, 0, .8);
}

.v-comp>.gal-arrow.left {
    left: 6px;
}

.v-comp>.gal-arrow.right {
    right: 6px;
}

.v-comp>.gal-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 5;
}

.v-comp>.gal-dots .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .5);
}

.v-comp>.gal-dots .dot.active {
    background: #fff;
}

/* ===== SHAPES ===== */
.v-shape {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v-shape svg {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.v-shape .shape-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    overflow: hidden;
    text-align: center;
    z-index: 2;
    line-height: 1.2;
    pointer-events: none;
    white-space: pre-wrap;
}

/* ===== MODAL ===== */
.modal-view {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-outer {
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

.modal-inner {
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
    transform-origin: top left;
    /* position:relative нужен для .markers-layer внутри модалки */
    position: relative;
}

.modal-inner .bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 0;
}

.modal-view .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-view .modal-close:hover {
    background: rgba(0, 0, 0, .8);
}

/* ===== TOOLTIP ===== */
.note-tip {
    position: fixed;
    background: rgba(15, 23, 42, .95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    max-width: 300px;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, .15);
    white-space: normal;
    word-wrap: break-word;
}

/* ===== GALLERY CROP WRAPPER ===== */
.gal-crop-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ===== КНОПКА "НА САЙТ" ===== */
.back-to-site-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 200;
    padding: 8px 14px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    pointer-events: auto;
    cursor: pointer;
}

.back-to-site-btn:hover {
    background: rgba(0, 0, 0, .85);
    border-color: rgba(255, 255, 255, .4);
}

/* ===== LOADING OVERLAY ===== */
.bg-img-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.v-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 5;
    pointer-events: none;
}

.v-loading-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.v-loading-text {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.v-loading-dots {
    display: flex;
    align-items: center;
    gap: 3px;
}

.v-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #60a5fa;
    animation: vDotBounce 1.4s ease-in-out infinite;
}

.v-dot:nth-child(1) {
    animation-delay: 0s;
}

.v-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.v-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes vDotBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

@media (min-width: 769px) {
    .canvas-scroll-wrapper {
        padding: 12px 20px;
    }

    .zoom-hint {
        display: none;
    }
}

.page-loader {
    position: fixed;
    inset: 0;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader__content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-loader__text {
    color: #e2e8f0;
    font-size: clamp(15px, 2vw, 18px);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.page-loader__dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 12px;
}

.page-loader__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #60a5fa;
    animation: pageLoaderBounce 1.2s ease-in-out infinite;
}

.page-loader__dot:nth-child(2) {
    animation-delay: 0.15s;
}

.page-loader__dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes pageLoaderBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-loader__dot {
        animation: none;
    }
}