.site-mascot {
    --mascot-height: 280px;
    --mascot-right: max(20px, env(safe-area-inset-right));
    --mascot-bottom: max(16px, env(safe-area-inset-bottom));
    position: fixed;
    inset: 0;
    z-index: 30;
    overflow: hidden;
    pointer-events: none;
}

.site-mascot[hidden],
.site-mascot [hidden] {
    display: none !important;
}

.site-mascot__stage,
.site-mascot__restore {
    position: absolute;
    right: var(--mascot-right);
    bottom: var(--mascot-bottom);
}

.site-mascot__stage {
    /* Кадр 960×720, рост рисунка 520. Правый край фигуры (x=715)
       совпадает с отступом кнопок; портал временно раскрывается слева. */
    width: calc(var(--mascot-height) * 1.846153846);
    height: calc(var(--mascot-height) * 1.384615385);
    right: calc(var(--mascot-right) - var(--mascot-height) * 0.471153846);
    bottom: calc(var(--mascot-bottom) + 50px - var(--mascot-height) * 0.103846154);
}

.site-mascot__figure {
    position: absolute;
    inset: 0;
}

.site-mascot__image,
.site-mascot__canvas {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
}

.site-mascot__hit {
    position: absolute;
    left: 54.8%;
    top: 19.9%;
    width: 19.7%;
    height: 72.8%;
    padding: 0;
    border: 0;
    border-radius: 40px;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
}

.site-mascot__hit:disabled {
    pointer-events: none;
}

.site-mascot__controls {
    position: fixed;
    right: var(--mascot-right);
    bottom: var(--mascot-bottom);
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.site-mascot__button,
.site-mascot__restore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    pointer-events: auto;
}

.site-mascot__button svg {
    width: 18px;
    height: 18px;
}

.site-mascot__restore {
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}

.site-mascot__button:hover,
.site-mascot__restore:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.site-mascot__button:focus-visible,
.site-mascot__restore:focus-visible,
.site-mascot__hit:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.site-mascot__button:disabled {
    cursor: default;
    opacity: 0.5;
}

.site-mascot__status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 640px), (max-height: 550px) {
    .site-mascot {
        --mascot-height: 190px;
        --mascot-right: max(10px, env(safe-area-inset-right));
        --mascot-bottom: max(10px, env(safe-area-inset-bottom));
    }
}
