:root {
    --verde: #53684b;
    --verde-medio: #74876c;
    --verde-claro: #eef3de;
    --texto: #30362d;
    --papel: #fffefa;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--texto);
    background: linear-gradient(
        145deg,
        #fffef8 0%,
        #f1f5df 55%,
        #dde6c5 100%
    );
}

.viewer {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 12px;
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    width: min(100%, 1220px);
    margin: 0 auto;
    padding: 8px;
    border: 1px solid rgba(83, 104, 75, 0.25);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 28px rgba(53, 68, 47, 0.14);
}

.toolbar button {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid rgba(83, 104, 75, 0.42);
    border-radius: 10px;
    background: #ffffff;
    color: var(--texto);
    font-size: 16px;
    cursor: pointer;
}

.toolbar button:first-child {
    justify-self: start;
}

.toolbar button:last-child {
    justify-self: end;
}

.toolbar button:hover {
    border-color: var(--verde);
    background: #f8faef;
}

.toolbar button:focus-visible {
    outline: 3px solid rgba(83, 104, 75, 0.28);
    outline-offset: 2px;
}

.toolbar button:disabled {
    opacity: 0.4;
    cursor: default;
}

.status {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 260px;
    text-align: center;
}

.status strong {
    color: var(--verde);
    font-size: 16px;
}

.status span {
    color: #667060;
    font-size: 14px;
}

.book-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 1220px);
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.32);
}

.flip-book {
    width: 100%;
    height: 100%;
}

.page {
    position: relative;
    overflow: hidden;
    background: var(--papel);
    box-shadow: inset 0 0 0 1px rgba(48, 54, 45, 0.1);
}

.page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
}

.hint {
    margin: 0;
    color: #667060;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 600px) {
    .viewer {
        gap: 6px;
        padding: 6px;
    }

    .toolbar {
        gap: 5px;
        padding: 5px;
        border-radius: 10px;
    }

    .toolbar button {
        min-width: 42px;
        padding: 7px;
        font-size: 0;
    }

    .toolbar button:first-child::after {
        content: "‹";
        font-size: 28px;
    }

    .toolbar button:last-child::after {
        content: "›";
        font-size: 28px;
    }

    .status {
        min-width: 0;
    }

    .status strong {
        font-size: 13px;
    }

    .status span {
        font-size: 12px;
    }

    .book-shell {
        border-radius: 10px;
    }

    .hint {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toolbar button {
        scroll-behavior: auto;
    }
}
