/* Сброс стилей */
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }

body {
    background-color: #000;
    color: #fff;
    font-family: 'Georgia', serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- ОБЛОЖКА --- */
#cover-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 1s ease;
    z-index: 10;
    position: absolute;
    top: 0; left: 0;
}

#cover-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* --- ЧИТАЛКА --- */
#reader-screen {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Отступы по бокам */
}

#page-img {
    /* Ограничиваем размер с учетом полей и UI */
    max-width: calc(100% - 40px);
    max-height: calc(100vh - 120px); /* 120px = место под UI + отступы */
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    display: block;
}

/* --- ИНТЕРФЕЙС (UI) --- */
#ui-controls {
    position: fixed;
    bottom: 30px; /* Поднял выше */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    pointer-events: auto;
    z-index: 100;
}

/* Кнопки */
button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-family: inherit;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    color: #fff;
}

/* Индикатор страницы */
#page-indicator {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

/* Поле ввода - минималистичное */
#goto-input-container {
    position: fixed;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    z-index: 101;
    background: rgba(0, 0, 0, 0.95);
    padding: 20px 30px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    text-align: center;
}

#goto-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    font-size: 24px;
    text-align: center;
    width: 120px;
    outline: none;
    font-family: inherit;
    padding: 5px 0;
}

/* Убираем стрелочки у input type="number" */
#goto-input::-webkit-outer-spin-button,
#goto-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#goto-input[type=number] {
    -moz-appearance: textfield;
}

/* Скрываем UI в полноэкранном режиме */
body.fullscreen-active #ui-controls,
body.fullscreen-active #page-indicator {
    display: none;
}

/* Адаптив */
@media (max-width: 600px) {
    #reader-screen {
        padding: 10px;
    }
    
    #page-img {
        max-width: calc(100% - 20px);
        max-height: calc(100vh - 100px);
    }
    
    #ui-controls {
        padding: 0 20px;
        bottom: 20px;
    }
}