@font-face {
    font-family: 'CustomFont';
    src: url('/assets/fonts/Encryption-Regular.ttf') format('truetype');
    font-display: block;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    cursor: pointer;
    background-color: #222;
}

#black-screen {
    width: 100%;
    height: 100%;
    background-color: #000;
    position: fixed;
    top: 0;
    left: 0;
    transition: opacity 0.5s ease;
    z-index: 100;
}

#black-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

#letter-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 80%;
    max-width: 600px;
    max-height: 70vh;
    padding: 40px;
    background: url('/assets/textures/parchment.jpg') center/cover no-repeat;
    color: #3a2a1a;
    border-radius: 5px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    will-change: transform, opacity;
        /* Optimizes animations */
        transition:
            opacity 0.3s ease-out,
            transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 90;
    border: 1px solid #6b4f32;
}

#letter-container.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#letter-container::-webkit-scrollbar {
    display: none;
}

#letter-content {
    font-family: 'CustomFont', monospace;
    font-size: 28px;
    line-height: 1;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: break-word;
}

.word {
    white-space: nowrap;
    display: inline-block;
}

.character {
    opacity: 0;
    display: inline-block;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.character.visible {
    opacity: 1;
    transform: translateY(0);
}

.candle-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%,
            rgba(255, 180, 70, 0.15),
            transparent 40%);
    opacity: 0;
    pointer-events: none;
    animation: flicker 3s infinite alternate;
    z-index: 2;
}

@keyframes flicker {

    0%,
    100% {
        opacity: 0.6;
    }

    25%,
    75% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.4;
    }
}

@media (max-width: 480px) {
    #letter-container {
        padding: 20px;
    }

    #letter-content {
        font-size: 18px !important;
        line-height: 1.3 !important;   }
}