
@font-face {
    font-family: "science-gothic-cyberfont";
    src: url("media/ScienceGothic_Expanded-ExtraLight.ttf") format("truetype");
    font-weight: 100 900;   /* единственное начертание ExtraLight: не даём браузеру делать faux-bold */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "science-gothic-cyberfont-bold";
    src: url("media/ScienceGothic_Expanded-Light.ttf") format("truetype");
    font-weight: 100 900;   /* единственное начертание ExtraLight: не даём браузеру делать faux-bold */
    font-style: normal;
    font-display: swap;
}


body {
    margin: 0px;
    overflow: hidden;
}

noscript {
    display: block;
    text-align: center;
    padding-top: 100px;
    font-size: 20px;
}

.v3d-container {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
}

.fullscreen-button {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    box-sizing: border-box;
    border-radius: 50%;
    background: rgba(18, 18, 20, 0.62);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    cursor: pointer;
    display: none;                 /* показывается скриптом приложения, если fullscreen поддерживается */
    z-index: 6000;                 /* выше маркеров POI */
    transition: background-color 0.2s ease;
}

.fullscreen-button:hover {
    background: rgba(40, 40, 44, 0.75);
}

/* иконка: белая, рисуется маской (классы fullscreen-open / fullscreen-close переключает приложение) */
.fullscreen-button::after {
    content: "";
    position: absolute;
    inset: 13px;
    background-color: rgba(255, 255, 255, 0.85);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: background-color 0.2s ease;
}

.fullscreen-button:hover::after {
    background-color: #fff;
}

.fullscreen-open::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E");
}

.fullscreen-close::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M20 15h-5v5M4 15h5v5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M20 15h-5v5M4 15h5v5'/%3E%3C/svg%3E");
}

/* removes tap blinking on ios devices */
* { -webkit-tap-highlight-color:rgba(0,0,0,0); }

/* Dark Theme */

.v3d-simple-preloader-background {
    background-color: #181818;
}

.v3d-simple-preloader-container {
    filter: drop-shadow(0px 0px 4px #2a69bd);
}

.v3d-webgl-error {
    color: lightgray;
}

a {
    color: #d6d6d6;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 2.0rem;
    font-family: "science-gothic-cyberfont";
    font-size: 12px;
  }
  a:hover {
    color: #ffffff;
  }

.preloader{
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #1c1c1c;
    visibility: visible;
    z-index: 100000;
}

.preloader__logo{
    position: absolute;
    left: 50%;
    top: calc(50% + 150px - 52px);
    transform: translate(-50%, -100%);
    width: min(72%, 480px);
    height: auto;
    display: block;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.percent{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-top: 150px;
    width: auto;
    height: auto;
    font-family:"science-gothic-cyberfont-bold";
    font-size: 20px;
    color: rgb(198, 198, 198);
}

.me {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);       
    display: flex;
    align-items: center;               
    justify-content: center;
    width: 30px;                        
    writing-mode: vertical-rl;          
    font-size: 12px;
    font-family: "science-gothic-cyberfont";
    color: beige;
    background: rgba(18, 18, 20, 0.62);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    cursor: pointer;
    z-index: 6000;
}

.me a {
    display: block;
    padding: 10px 0;                    /* отступы по длине текста; вся область кликабельна */
    color: inherit;
    text-decoration: none;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transform: rotate(180deg);             /* текст читается снизу вверх */
    transition: color 0.2s ease;
}

.me a:hover,
.me a:focus-visible {
    color: #fff;
    outline: none;
}

/* POI markers */

/* Корневой элемент двигает puzzle "bind elem to object" через transform,
   поэтому сам он без размеров и без своих transform. Кружок центруется внутри. */
.poi {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;                      /* показываем после bind (см. puzzles) */
    transition: opacity 0.4s ease;
}

.poi__ring {
    --poi-size: 26px;
    position: absolute;
    left: calc(var(--poi-size) / -2);
    top: calc(var(--poi-size) / -2);
    width: var(--poi-size);
    height: var(--poi-size);
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* лёгкая пульсация */
.poi__ring::after {
    content: "";
    position: absolute;
    inset: -2px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: poi-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

.poi__ring:hover {
    transform: scale(1.25);
    background-color: rgba(255, 255, 255, 0.18);
}

@keyframes poi-pulse {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(1.9); opacity: 0; }
}

@media (max-width: 600px) {
    .poi__ring { --poi-size: 22px; }
}

/* Menu */

/* z-index выше маркеров POI: puzzles ставят им z-index до ~5000 */
.menu {
    position: absolute;
    right: 0;
    bottom: 33px;
    z-index: 6000;
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 20px 0 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(5px);
    /* border-radius: 33px 0 0 33px; */
    color: rgba(255, 255, 255, 0.72);
    font-family: "science-gothic-cyberfont";
    font-weight: 500;
    user-select: none;
}

.menu__list {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu__item,
.menu__back {
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease;
}

.menu__item {
    position: relative;
    padding: 6px 0;
}

.menu__item::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s ease;
}

.menu__item:hover,
.menu__item:focus-visible,
.menu__item.is-active,
.menu__back:hover,
.menu__back:focus-visible {
    color: rgba(255, 255, 255, 0.95);
    outline: none;
}

.menu__item:hover::after,
.menu__item:focus-visible::after,
.menu__item.is-active::after {
    transform: scaleX(1);
}

/* «Назад» — первый элемент плашки. Скрыт (ширина 0), при .is-visible раскрывается,
   и плашка, прижатая к правому краю, растягивается влево. */
.menu__back {
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: 0;
    margin-right: 0;
    padding: 6px 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    font-family:"science-gothic-cyberfont-bold";
    transition: max-width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), margin-right 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.3s ease, color 0.2s ease;
}

.menu__back.is-visible {
    max-width: 160px;
    margin-right: 32px;
    opacity: 1;
    pointer-events: auto;
}

/* Логотип — последний элемент плашки, белый (SVG чёрный -> filter). Высоту плашки не меняет. */
.menu__logo {
    flex: 0 0 auto;
    height: 35px;
    width: auto;
    margin-left: 20px;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: brightness(0) invert(1);
}

/* Overlay — белый текст в левом нижнем углу, без плашки */
.overlay {
    position: absolute;
    left: 50px;
    bottom: 111px;
    z-index: 6000;
    width: 550px;
    box-sizing: border-box;
    font-family: "science-gothic-cyberfont";
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transition: opacity 1s ease;
}

#over_capacity {
    top: 120px;
}

#over_interior {
    top: 120px;
}

#over_battery {
    bottom: 160px;
}

#over_bag {
    left: auto;
    right: 80px;
    text-align: right;
    bottom: 160px;
}

.overlay__title {
    margin: 0 0 10px;
    font-family: "science-gothic-cyberfont-bold";
    font-size: 36px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
    color: #fff;
}

.overlay__description {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0.01em;
    color: #fff;
}

@media (max-width: 900px) {
    /* .overlay { left: 22px; bottom: 88px; } */
    #over_bag { left: auto; right: 22px; }
    .overlay__title { font-size: 16px; }
}

@media (max-width: 640px) {
    .overlay {
        left: 16px;
        bottom: 70px;
        width: min(400px, calc(100% - 32px));
    }
    #over_bag { left: auto; right: 16px; }
    .overlay__title { font-size: 15px; }
    .overlay__description { font-size: 12px; }
}

/* Sound button */

.sound {
    position: absolute;
    top: 24px;
    right: 84px;
    z-index: 6000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 46px;
    height: 46px;
    padding: 14px 0;
    box-sizing: border-box;
    border: 0;
    border-radius: 50%;
    background: rgba(18, 18, 20, 0.62);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sound:hover,
.sound:focus-visible {
    background: rgba(40, 40, 44, 0.75);
    outline: none;
}

.sound__bar {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.85);
    transform-origin: 50% 100%;
    transform: scaleY(0.18);               /* музыка выключена: плоский эквалайзер */
    transition: transform 0.3s ease;
}

.sound.is-on .sound__bar {
    animation: sound-eq 1s ease-in-out infinite;
}

.sound.is-on .sound__bar:nth-child(1) { animation-duration: 0.9s;  animation-delay: -0.2s; }
.sound.is-on .sound__bar:nth-child(2) { animation-duration: 1.15s; animation-delay: -0.7s; }
.sound.is-on .sound__bar:nth-child(3) { animation-duration: 0.8s;  animation-delay: -0.4s; }
.sound.is-on .sound__bar:nth-child(4) { animation-duration: 1.05s; animation-delay: -0.9s; }
.sound.is-on .sound__bar:nth-child(5) { animation-duration: 0.95s; animation-delay: -0.1s; }

@keyframes sound-eq {
    0%, 100% { transform: scaleY(0.2); }
    50%      { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .sound.is-on .sound__bar { animation: none; transform: scaleY(0.6); }
}

/* Mobile */

html, body { overscroll-behavior: none; }

/* бургер и обёртка панели: на десктопе незаметны */
.menu__burger { display: none; }
.menu__panel { display: contents; }

/* сенсорные экраны: увеличенная зона нажатия у маркеров POI, без «залипающего» hover */
@media (pointer: coarse) {
    .poi__ring::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
}
@media (hover: none) {
    .poi__ring:hover { transform: none; background-color: transparent; }
}

/* ---------- телефоны и небольшие планшеты: меню -> бургер, круглые кнопки ---------- */
@media (max-width: 900px), (max-height: 500px) {

    /* плашка исчезает: остаются [Назад] и [бургер], список выезжает панелью над ними */
    .menu {
        left: auto;
        right: calc(14px + env(safe-area-inset-right, 0px));
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        height: auto;
        padding: 0;
        background: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        border-radius: 0;
    }

    .menu__burger {
        order: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 48px;
        height: 48px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: rgba(18, 18, 20, 0.62);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        cursor: pointer;
    }

    .menu__burger span {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.85);
        transition: transform 0.3s ease, opacity 0.2s ease;
    }

    .menu.is-open .menu__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu.is-open .menu__burger span:nth-child(2) { opacity: 0; }
    .menu.is-open .menu__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* «Назад»: отдельная таблетка слева от бургера, выезжает по-прежнему классом is-visible */
    .menu__back {
        order: 1;
        height: 48px;
        box-sizing: border-box;
        border-radius: 24px;
        background: rgba(18, 18, 20, 0.62);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        font-size: 15px;
        padding: 0;
        transition: max-width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), margin-right 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
                    padding 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease, color 0.2s ease;
    }

    .menu__back.is-visible {
        max-width: 160px;
        margin-right: 10px;
        padding: 0 20px 0 14px;
    }

    /* панель с пунктами: выезжает вверх от бургера */
    .menu__panel {
        position: absolute;
        right: 0;
        bottom: calc(100% + 10px);
        display: flex;
        flex-direction: column;
        width: min(300px, calc(100vw - 28px));
        max-height: calc(100vh - 140px);
        max-height: calc(100dvh - 140px);
        overflow-y: auto;
        padding: 6px 20px 16px;
        box-sizing: border-box;
        border-radius: 22px;
        background: rgba(18, 18, 20, 0.72);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(10px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    }

    .menu.is-open .menu__panel {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition-delay: 0s;
    }

    .menu__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .menu__item {
        width: 100%;
        padding: 15px 0;
        font-size: 17px;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .menu__list li:last-child .menu__item { border-bottom: 0; }

    .menu__logo {
        align-self: center;
        height: 24px;
        margin: 14px 0 0;
    }

    /* круглые кнопки: музыка и полный экран (по умолчанию вверху справа) */
    .sound,
    .fullscreen-button {
        top: calc(14px + env(safe-area-inset-top, 0px));
        width: 44px;
        height: 44px;
    }
    .sound { right: calc(68px + env(safe-area-inset-right, 0px)); left: auto; padding: 13px 0; }
    .fullscreen-button { right: calc(14px + env(safe-area-inset-right, 0px)); left: auto; }
    .fullscreen-button::after { inset: 12px; }

    /* ссылка .me уже и мельче */
    .me { width: 24px; font-size: 10px; }
}

/* ---------- вертикальная ориентация: тексты сверху, бургер и кнопки снизу ---------- */
@media (max-width: 900px) and (orientation: portrait) {

    .sound,
    .fullscreen-button {
        top: auto;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        width: 48px;
        height: 48px;
    }
    .sound { left: calc(14px + env(safe-area-inset-left, 0px)); right: auto; padding: 15px 0; }
    .fullscreen-button { left: calc(72px + env(safe-area-inset-left, 0px)); right: auto; }
    .fullscreen-button::after { inset: 14px; }

    /* все overlay-тексты — сверху на всю ширину (id-селекторы перебивают позиции десктопа) */
    #v3d-container .overlay,
    #v3d-container #over_capacity,
    #v3d-container #over_interior,
    #v3d-container #over_battery,
    #v3d-container #over_bag {
        top: calc(16px + env(safe-area-inset-top, 0px));
        bottom: auto;
        left: calc(16px + env(safe-area-inset-left, 0px));
        right: calc(16px + env(safe-area-inset-right, 0px));
        width: auto;
        text-align: left;
        text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
    }

    #v3d-container .overlay__title {
        margin-bottom: 8px;
        font-size: 20px;
        line-height: 1.1;
    }

    #v3d-container .overlay__description {
        font-size: 13px;
        line-height: 1.4;
    }
}

/* ---------- телефон в горизонтальной ориентации: тексты компактнее, внизу слева ---------- */
@media (orientation: landscape) and (max-height: 500px) {

    #v3d-container .overlay,
    #v3d-container #over_capacity,
    #v3d-container #over_interior,
    #v3d-container #over_battery {
      
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        left: calc(16px + env(safe-area-inset-left, 0px));
        right: auto;
        width: min(44vw, 440px);
        text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
    }

    /* этот текст лежит справа: над бургером и левее ссылки .me */
    #v3d-container #over_bag {
        top: auto;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        left: auto;
        right: calc(44px + env(safe-area-inset-right, 0px));
        width: min(40vw, 400px);
        text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
    }

    #v3d-container .overlay__title {
        margin-bottom: 6px;
        font-size: 16px;
        line-height: 1.1;
    }

    #v3d-container .overlay__description {
        font-size: 11.5px;
        line-height: 1.35;
    }
}
