body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Изменено с center на flex-start для верхнего позиционирования */
    min-height: 100vh; /* Изменено на min-height, чтобы избежать обрезки на маленьких экранах */
    margin: 0;
    font-family: 'Courier New', monospace;
    color: #00ff00; /* Зелёный как в Pip-Boy */
}

.pip-boy {
    background-color: #1a1a1a;
    border: 5px solid #333;
    border-radius: 10px;
    padding: 20px;
    width: 600px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5); /* Glow эффект */
    position: relative;
    margin-top: 40px; /* Базовый отступ сверху */
}

.screen {
    position: relative;
    width: 100%;
    height: 400px;
    background-color: #003300;
    overflow: hidden;
    border: 2px solid #00ff00;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Убраны эффекты: фильтр и мерцание */
}

#loading {
    color: #00ff00;
    text-align: center;
    padding: 20px;
    font-size: 18px;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.05) 1px,
        transparent 2px
    );
    pointer-events: none;
}

.distortion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.05) 0%,
        transparent 2%,
        rgba(255, 255, 255, 0.05) 4%,
        transparent 6%
    );
    background-size: 100% 200%;
    opacity: 0;
    pointer-events: none;
}

.distortion.active {
    animation: distort 0.5s ease-in-out forwards;
}

/* Полоска-рывок и эффект ряби */

.tear {
    position: fixed;
    left: 0;
    width: 100%;
    top: var(--tearY, 40%);
    height: 12px;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.09) 50%, transparent 100%);
    mix-blend-mode: screen;
    z-index: 1000;
}

body.ripple .tear {
    opacity: .85;
    animation: tearShift 120ms ease-in-out 3 alternate;
}

@keyframes tearShift {
    from { transform: translateX(-6px); }
    to { transform: translateX(6px); }
}

body.ripple {
    filter: url(#crt-warp);
}

@keyframes distort {
    0% { opacity: 0; background-position: 0 0; }
    50% { opacity: 0.3; background-position: 0 100%; }
    100% { opacity: 0; background-position: 0 200%; }
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

button {
    background-color: #003300;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #006600;
}

#page-counter {
    align-self: center;
    font-size: 18px;
}

.content {
    margin-top: 20px;
    text-align: left; /* Выровнено по левому краю */
    font-size: 14px;
    display: none; /* Изначально скрыто */
}

/* Медиа-запрос для мобильных устройств */
@media (max-width: 600px) {
    .pip-boy {
        width: 90%; /* Адаптация ширины */
        margin-top: 60px; /* Больше отступа сверху на мобильных */
        padding: 10px; /* Уменьшение padding для мобильных */
    }

    .screen {
        height: 300px; /* Уменьшение высоты экрана для мобильных */
    }
}
