@charset "UTF-8";

body {
    background-color: #333;
    margin: 0; padding: 0;
    height: 100dvh; 
    width: 100vw;
    overflow: hidden;
    font-family: sans-serif;
    display: flex; flex-direction: column;
    overscroll-behavior: none;
}

.viewport {
    flex-grow: 1;
    width: 100%;
    height: calc(100% - 60px); 
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    position: relative;
    touch-action: none; 
    background-color: #333;
    cursor: default;
}

/* ズーム時はカーソルを変更 */
.viewport.grab { cursor: grab; }
.viewport.grabbing { cursor: grabbing; }

#transformContainer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center;
}

.book-wrapper {
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.page {
    background-color: #fff;
    overflow: hidden;
    position: relative; 
}

.page::before {
    content: "Loading...";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc; font-size: 14px; z-index: 0;
}

.page img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 1;
    background-color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    pointer-events: none;
}
.page img.loaded { opacity: 1; visibility: visible; }

.controls {
    height: 60px;
    background-color: #222;
    display: flex; justify-content: center; align-items: center;
    gap: 15px; color: white;
    z-index: 9999;
    border-top: 1px solid #444;
    padding: 0 20px;
    flex-shrink: 0;
}

button {
    background-color: #444; color: white;
    border: 1px solid #666; padding: 8px 16px;
    cursor: pointer; border-radius: 4px;
    user-select: none;
    font-size: 14px;
    min-width: 44px;
    min-height: 44px;
}
button:active { background-color: #666; }

.page-input-group { display: flex; align-items: center; gap: 5px; }

input[type="number"] {
    width: 50px; padding: 6px; text-align: center;
    border-radius: 4px; border: 1px solid #666;
    font-size: 16px;
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    margin: 0;
    height: 30px;
}
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; margin: 0; 
}