/* Tumski page specific styles */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
}

.scene {
    width: 100vw;
    height: 100vh;
    position: relative;
    clip-path: inset(0);
    perspective: 1000px;
    transform-style: preserve-3d;
    transform: translateZ(0);
    /* Контейнер для всех элементов сцены */
    overflow: hidden;
}

.zoom-transition {
    animation: zoomForward 1.5s ease-in forwards !important;
}

.image-container {
    position: absolute;
    inset: 0;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: center;
    transform-origin: center;
    -webkit-animation: moveForward 40s linear infinite;
    animation: moveForward 40s linear infinite;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    overflow: hidden;
    /* Низкий z-index - фон */
    z-index: 1;
}

.image-container.zoom-transition {
    animation: zoomForward 1.5s ease-in forwards !important;
}

.image.fade-to-next {
    transition: opacity 0.1s ease-in;
    opacity: 0;
}

.fade-out {
    opacity: 0;
}

.fade-in {
    opacity: 1;
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    color: white;
    text-decoration: none;
    font-size: 16px;
    z-index: 1000;
    background: none;
    border-radius: 4px;
    transition: background 0.3s ease;
    width: 64px;
    height: 64px;
    display: block;
}

.back-link:hover {
    background: rgba(0, 0, 0, 0.9);
}

.back-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border: none;
}

.reset-animation {
    animation: none !important;
    transform: translateZ(0px) !important;
}

.content-wrapper {
    position: relative;
    display: flex;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    width: fit-content !important;
    min-width: fit-content !important;
    max-width: none !important;
    overflow: visible !important;
    height: 100% !important;
    min-height: 100% !important;
}

.content-wrapper:hover {
    opacity: 1; /* Показываем картинку при наведении */
}

.papera-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: relative;
    z-index: 1;
    opacity: 1 !important;
    transition: opacity 0.3s ease;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
}

.tumski-text {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: fit-content;
    padding: 0 20px;
    z-index: 2 !important;
    font-family: 'Roboto', sans-serif;
    font-weight: 200;
    font-style: italic;
    font-size: 28px;
    color: #795f59;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    text-align: center;
    pointer-events: auto;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.map-mark-area:hover .map-mark,
.map-mark-area:hover .tumski-text,
.map-mark-area:hover .papera-image {
    opacity: 1;
}

/* Создаем расширенную область вокруг геометки для легкой активации */
.map-mark::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    right: -50px;
    bottom: -50px;
    background: transparent;
    border-radius: 50%;
    pointer-events: auto;
    z-index: 997;
    /* Добавляем невидимую границу для отладки (можно убрать) */
    /* border: 1px solid rgba(255, 0, 0, 0.1); */
}

/* При наведении на расширенную область показываем геометрию */
.map-mark:hover::before {
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

/* Убеждаемся, что расширенная область позиционируется относительно map-mark */
.map-mark {
    position: relative !important;
}

.book-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.book-container {
    position: relative;
    max-width: 100%;
    max-height: 100vh;
    overflow: hidden;
}

.book-image {
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

.scroll-indicator {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: #333;
    font-size: 16px;
    opacity: 0.7;
    z-index: 1003;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-indicator::after {
    content: "▼";
    display: block;
}

.book-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-height: 80%;
    overflow-y: hidden;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
    transition: overflow-y 0.3s ease;
}

.book-content.show-scrollbar {
    overflow-y: auto;
}

.book-content::-webkit-scrollbar {
    width: 6px;
}

.book-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.book-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.book-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 200;
    font-style: italic;
    color: #333;
    font-size: 32px;
    margin: 10px 0 5px 0;
}

/* Мобильные стили для заголовка квеста */
@media (max-width: 768px) {
    .book-title {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        background: rgba(255, 255, 255, 0.9) !important;
        padding: 15px !important;
        margin: 0 0 20px 0 !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        z-index: 10 !important;
    }
}

@media (max-width: 480px) {
    .book-title {
        font-size: 24px !important;
        padding: 12px !important;
        margin: 0 0 15px 0 !important;
    }
}

.book-text {
    font-family: Arial, sans-serif;
    color: #333;
    font-size: 18px;
    line-height: 1.6;
    margin: 0;
}

.content-image {
    max-width: 100%;
    height: auto;
    margin: 5px 0 20px 0;
    border-radius: 8px;
}

.close-button {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid white;
    border-radius: 50%;
    padding: 10px;
    z-index: 1002;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.arrow-click-area {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 50%;
    height: 50%;
    z-index: 999;
    cursor: none;
}

@font-face {
    font-family: 'Roboto';
    src: url('media/Roboto-ExtraLightItalic.ttf') format('truetype');
    font-weight: 200;
    font-style: italic;
}

.hide-cursors {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.book-zones {
    position: absolute;
    top: 0;
    width: 10%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.right-zones {
    right: 0;
}

.left-zones {
    left: 0;
}

.book-zone {
    position: absolute;
    width: 100%;
    background-color: transparent;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.7s ease-in-out;
}

.right-zones .book-zone {
    right: 0;
}

.left-zones .book-zone {
    left: 0;
}

.book-zone:hover,
.book-zone.highlight {
    background-color: rgba(255, 255, 255, 0.45);
}

@keyframes highlightPulse {
    0% { 
        background-color: rgba(255, 255, 255, 0);
    }
    100% { 
        background-color: rgba(255, 255, 255, 0.45);
    }
}

.book-zone.highlight {
    animation: highlightPulse 0.5s ease-in-out forwards;
}

.zone {
    transition: all 0.1s ease-in-out;
}

.zone.highlight {
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.music-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    z-index: 2000;
    display: none;
    animation: fadeInOut 6s ease-in-out;
}

.animation-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    z-index: 2000;
    display: none;
    animation: fadeInOut 6s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

.audio-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Общие стили для стрелок */
.custom-cursor {
    width: 64px;
    height: 64px;
    position: fixed;
    pointer-events: none;
    background-image: url('media/strelka.png');
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    cursor: pointer;
}

.custom-cursor-prosto {
    width: 64px;
    height: 64px;
    position: fixed;
    background-image: url('media/strelka_prosto.png');
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    cursor: pointer;
    pointer-events: auto;
}

/* Hover эффекты для стрелок - только для тач-режима */
html[data-input-type="touch"] .custom-cursor-prostoarea:hover .custom-cursor-prosto {
    opacity: 1;
}

/* Общие стили для mapmark */
.map-mark {
    width: 48px;
    height: 48px;
    background-image: url('media/mapmark.png');
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Базовый высокий z-index для всех устройств */
    position: absolute;
    z-index: 10000;
    /* Принудительное создание GPU-слоя для старых iOS */
    transform: translateZ(0);
    will-change: transform;
}

/* Отключаем анимацию moveForward на старых планшетах (iPad 5-9 поколения) */
@media screen and (-webkit-min-device-pixel-ratio: 1) and (min-width: 768px) and (max-width: 1024px),
       screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 768px) and (max-width: 1024px) {
    .image-container {
        -webkit-animation: none !important;
        animation: none !important;
        /* 2D-версия анимации moveForward для старых планшетов с вендорными префиксами */
        -webkit-animation: moveForward-2d 40s linear infinite;
        animation: moveForward-2d 40s linear infinite;
    }
}

/* Специфические стили для старых iOS - принудительное создание GPU-слоев */
@media screen and (-webkit-min-device-pixel-ratio: 1) and (max-device-width: 1024px),
       screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width: 1024px) {
    .map-mark-area {
        transform: translateZ(0.1px) !important;
        z-index: 10000 !important;
    }
    
    .map-mark {
        transform: translateZ(0.1px) !important;
        z-index: 10000 !important;
    }
    
    .map-mark::before {
        transform: translateZ(0.1px) !important;
        z-index: 9999 !important;
    }
    
    .extended-hover-area {
        transform: translateZ(0.1px) !important;
        z-index: 9999 !important;
    }
    
    /* Квест-геометки должны быть еще выше */
    .map-mark-area:has([data-quest-number]) {
        transform: translateZ(0.2px) !important;
        z-index: 10001 !important;
    }
    
    .map-mark-area:has([data-quest-number]) .map-mark {
        transform: translateZ(0.2px) !important;
        z-index: 10001 !important;
    }
    
    .map-mark-area:has([data-quest-number]) .map-mark::before {
        transform: translateZ(0.2px) !important;
        z-index: 10001 !important;
    }
    
    .map-mark-area:has([data-quest-number]) .extended-hover-area {
        transform: translateZ(0.2px) !important;
        z-index: 10001 !important;
    }
}

/* Альтернативные анимации для старых планшетов */
@keyframes gentleFade {
    0% { 
        opacity: 0.95;
        filter: brightness(1);
    }
    100% { 
        opacity: 1;
        filter: brightness(1.05);
    }
}

@keyframes subtleZoom {
    0% { 
        transform: translateZ(0) scale(1);
    }
    100% { 
        transform: translateZ(0) scale(1.03);
    }
}

@keyframes softPulse {
    0% { 
        filter: contrast(1) saturate(1);
    }
    100% { 
        filter: contrast(1.05) saturate(1.1);
    }
}

/* 2D-версия анимации moveForward для старых планшетов */
@-webkit-keyframes moveForward-2d {
    from {
        -webkit-transform: scale(1) translateX(0);
        transform: scale(1) translateX(0);
    }
    to {
        -webkit-transform: scale(2.5) translateX(0);
        transform: scale(2.5) translateX(0);
    }
}

@keyframes moveForward-2d {
    from {
        -webkit-transform: scale(1) translateX(0);
        transform: scale(1) translateX(0);
    }
    to {
        -webkit-transform: scale(2.5) translateX(0);
        transform: scale(2.5) translateX(0);
    }
}

/* Новые анимации для старых планшетов */
@keyframes gentleSlide {
    0% { 
        transform: translateZ(0) translateX(0);
    }
    100% { 
        transform: translateZ(0) translateX(20px);
    }
}

@keyframes breathing {
    0% { 
        transform: translateZ(0) scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: translateZ(0) scale(1.01);
        filter: brightness(1.02);
    }
    100% { 
        transform: translateZ(0) scale(1);
        filter: brightness(1);
    }
}

@keyframes colorShift {
    0% { 
        filter: hue-rotate(0deg) saturate(1);
    }
    100% { 
        filter: hue-rotate(5deg) saturate(1.05);
    }
}

/* УДАЛЕНО: .modal-right-content, .most-title, .most-description (модальное окно) и их медиа-запросы */

/* Стили для кнопки разблокировки аудио */
.audio-unlock-button {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border: 2px solid white;
    border-radius: 15px;
    padding: 20px 30px;
    cursor: pointer;
    z-index: 99999;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 250px;
}

.audio-unlock-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) scale(1.05);
}

.audio-unlock-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.audio-unlock-icon {
    font-size: 32px;
}

.audio-unlock-text {
    font-size: 16px;
    font-weight: bold;
} 