 .htgreed.scene-open .scene {display:block}
 :root {
            /* Увеличили размеры книги */
            --book-width: 380px; 
            --book-height: 540px;
            --duration: 0.8s;
            /* Сделали цвета немного светлее */
            --bg-color: #2a2a2a;
            --paper-color: #363636;
            --text-color: #e0e0e0;
            --accent-color: #a78bfa; /* Светло-фиолетовый */
            --border-pixel: 4px;
        }

        

        .scanlines {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: linear-gradient(
                to bottom,
                rgba(255,255,255,0),
                rgba(255,255,255,0) 50%,
                rgba(0,0,0,0.1) 50%,
                rgba(0,0,0,0.1)
            );
            background-size: 100% 4px;
            pointer-events: none;
            z-index: 999;
        }

        .scene {
        display:none;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-left: calc(var(--book-width) * -1);
            margin-top: calc(var(--book-height) / -2);
            width: calc(var(--book-width) * 2); 
            height: var(--book-height);
            perspective: 1500px;
            cursor: grab;
            touch-action: none;
        }

        .scene:active {
            cursor: grabbing;
        }

        .book {
            position: relative;
            width: 100%;
            height: 100%;
            transform-style: preserve-3d;
        }

        .sheet {
            position: absolute;
            width: var(--book-width);
            height: 100%;
            top: 0;
            left: 50%;
            transform-origin: left center;
            transform-style: preserve-3d;
            transition: transform var(--duration) cubic-bezier(0.645, 0.045, 0.355, 1);
            cursor: pointer;
            z-index: 1;
        }

        .front, .back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            box-sizing: border-box;
            background-color: var(--paper-color);
            border: var(--border-pixel) solid #555;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
        }

        .front {
            z-index: 2;
        }

        .back {
            transform: rotateY(180deg);
            z-index: 1;
        }

        .sheet.flipped {
            transform: rotateY(-180deg);
        }

        /* Кнопка закрытия (крестик) */
        .close-btn {
            position: absolute;
            top: -30px;
            right: -30px;
            width: 40px;
            height: 40px;
            background-color: #333;
            border: 2px solid #555;
            color: #fff;
            font-size: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1000;
            user-select: none;
        }
        .close-btn:hover {
            background-color: #d32f2f;
            border-color: #ff5252;
        }

        /* --- Custom Styles --- */
        
        .content-box {
            padding: 25px;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            box-sizing: border-box;
        }
        
        .image-box {
            padding: 25px;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #2a2a2a;
            box-sizing: border-box;
            position: relative;
        }

        .pixel-title {
            font-size: 3.5rem;
            color: var(--accent-color);
            text-transform: uppercase;
            text-shadow: 4px 4px 0px #000;
            letter-spacing: 2px;
            text-align: center;
            margin: 0;
            line-height: 1;
        }

        .pixel-subtitle {
            margin-top: 1rem;
            font-size: 1.5rem;
            color: #9ca3af;
        }

        .pixel-hint {
            margin-top: 2rem;
            font-size: 1rem;
            color: #c4b5fd;
        }

        .chapter-title {
            font-size: 1.8rem;
            color: #c4b5fd;
            margin-bottom: 1rem;
            border-bottom: 2px solid #6d28d9;
            padding-bottom: 0.5rem;
            margin-top: 0;
        }
        
        .chapter-title.nerpa {
            color: #60a5fa; /* Blue for Nerpa */
            border-color: #1e40af;
        }
        
        .chapter-title.wolf {
            color: #e5e7eb; /* White/Gray for Wolf */
            border-color: #4b5563;
        }

        .pixel-text {
            /* Уменьшили шрифт, чтобы вместить больше текста */
            font-size: 1.15rem; 
            line-height: 1.4;
            text-shadow: 1px 1px 0px #000;
            text-align: justify;
            margin: 0;
        }

        .pixel-img {
            width: 100%;
            height: auto;
            max-height: 80%;
            object-fit: contain;
            image-rendering: pixelated;
            border: 4px solid #000;
            box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
            margin: 0 auto;
            pointer-events: none;
        }

        .page-number {
            position: absolute;
            bottom: 15px;
            font-size: 1.2rem;
            color: #888;
        }
        .front .page-number { right: 20px; }
        .back .page-number { left: 20px; }

        .cover-decor {
            border: 6px double var(--accent-color);
            padding: 20px;
            height: 90%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: url('https://img.freepik.com/free-vector/pixel-art-mystical-background_52683-87349.jpg?w=740&t=st=1709123456~exp=1709124056~hmac=abcdef') center/cover;
            position: relative;
            box-sizing: border-box;
        }
        
        .cover-decor::before {
            content: '';
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,0.6);
            z-index: 0;
        }
        
        .cover-content {
            position: relative;
            z-index: 1;
            text-align: center;
        }

        .btn-restart {
            margin-top: 2rem;
            border: 2px solid #666;
            padding: 0.5rem 1rem;
            display: inline-block;
            cursor: pointer;
            transition: background 0.2s;
            font-size: 1.2rem;
        }
        .btn-restart:hover {
            background-color: #444;
            color: #fff;
        }
        
/* Сетка персонажей */
.char-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.char-icon-btn {
    width: 30%;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.char-icon-btn:hover { transform: scale(1.1); }

.char-thumb {
    width: 200px;
    height: 200px;
    object-fit: contain;
    image-rendering: pixelated;
    border: 2px solid #000;
    background: #fff;
}

.char_title{
    display: flex;
    justify-content: space-between;
    height: 10%;
    align-items: flex-start;
    flex-wrap: wrap;
}
.char-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    margin-top: 5px;
    color: #000;
}

.btn-read-book {
    display: block;
    width: 200px;
    margin: 20px auto;
    padding: 15px;
    background: #dfde48;
    border: 4px solid #000;
    text-align: center;
    font-family: 'Press Start 2P';
    font-size: 12px;
    color: #000;
    text-decoration: none;
}
.btn-read-book:hover { background: #6fcd64; }

.char-card-layout {
    display: flex;
    flex: 1;
    overflow: scroll; /* Чтобы не скроллилось всё окно */
    gap: 20px;
    padding: 10px;
}


.char-visual {
    width: 40%; /* Фиксированная ширина для левой колонки */
    height:90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0; /* Не сжиматься */
}
.char-card_into{
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.char-info {
    width: 60%;
    overflow-y: auto; /* Скролл для текста */
    padding-right: 5px;
    height:90%;
}

#card-char-name {
    font-family: 'Press Start 2P';
    font-size: 20px;
    margin-top: 15px;
    transform: rotate(0deg);
}

/* Фикс для кнопки назад */
.btn-back-chars {
    background: #dfde48;
    border: 2px solid #000;
    font-family: 'Press Start 2P';
    font-size: 10px;
    cursor: pointer;
    padding: 5px 10px;
    color: #000;
    text-transform: uppercase;
    margin:10px;
}
.btn-back-chars:hover { background: #6fcd64; }
/* Блок координат */
.coords-box {
    margin-top: 15px;
    border: 2px solid #000;
    background: #eee;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Press Start 2P';
    font-size: 10px;
    text-align: center;
}

/* ИНТЕРАКТИВНАЯ ГИФКА */
.gif-container {
    width: 300px;
    height: 300px;
    border: 4px solid #000;
    background: #fff;
    position: relative;
    cursor: col-resize; /* Курсор показывает, что можно тянуть */
    display: flex;
    justify-content: center;
    align-items: center;
}
/* Контейнер для канваса */
.gif-scrubber-container {
    width: 100%;  /* Размер области просмотра */
    height: 100%;
    background: #fff;
    border: 4px solid #000;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Чтобы гифка не вылезала */
}
/* Канвас, который генерирует библиотека */
.jsgif {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.jsgif canvas {
    max-width: 100%;
    max-height: 100%;
    cursor: grab;
    image-rendering: pixelated; /* Сохраняем пиксельность */
}

.drag-hint {
    position: absolute;
    bottom: 5px;
    width: 100%;
    text-align: center;
    font-family: 'Press Start 2P';
    font-size: 8px;
    color: #555;
    pointer-events: none;
    opacity: 0.7;
}

        @media (max-width: 640px) {
            .scene {
                transform: scale(0.6); 
            }
            .close-btn {
                top: -40px;
                right: 0;
            }
            .char-thumb {
                width: 80px;
                height: 80px;
            }
        }
