.ibr-reader {
    --ibr-bg: #171717;
    --ibr-panel: #242424;
    --ibr-text: #f5f5f5;
    --ibr-muted: #b9b9b9;
    --ibr-border: #444;
    width: 100%;
    max-width: 1700px;
    margin: 2rem auto;
    padding: 1rem;
    box-sizing: border-box;
    background: var(--ibr-bg);
    border-radius: 10px;
    color: var(--ibr-text);
}

.ibr-title {
    margin: 0 0 1rem;
    color: inherit;
    text-align: center;
}

.ibr-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1rem;
}

.ibr-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: .55rem .85rem;
    border: 1px solid var(--ibr-border);
    border-radius: 6px;
    background: var(--ibr-panel);
    color: var(--ibr-text) !important;
    text-decoration: none !important;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
}

.ibr-button:hover,
.ibr-button:focus-visible {
    background: #333;
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.ibr-button:disabled {
    opacity: .4;
    cursor: default;
}

.ibr-counter {
    min-width: 82px;
    text-align: center;
    color: var(--ibr-muted);
    font-variant-numeric: tabular-nums;
}

.ibr-stage {
    width: 100%;
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.ibr-book {
    margin: 0 auto;
}

.ibr-thumbnails {
    display: flex;
    gap: .6rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .9rem .2rem .2rem;
    margin-top: .8rem;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.ibr-thumb {
    flex: 0 0 auto;
    width: 76px;
    margin: 0;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 5px;
    background: var(--ibr-panel);
    color: var(--ibr-text);
    cursor: pointer;
    scroll-snap-align: center;
    box-sizing: border-box;
}

.ibr-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 2px;
}

.ibr-thumb span {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--ibr-muted);
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ibr-thumb:hover,
.ibr-thumb:focus-visible,
.ibr-thumb.is-active {
    border-color: currentColor;
    outline: none;
}

.ibr-thumb.is-active span {
    color: var(--ibr-text);
}

.ibr-reader:fullscreen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    margin: 0;
    padding: 1rem;
    border-radius: 0;
    overflow: auto;
}

.ibr-reader:fullscreen .ibr-stage {
    min-height: calc(100vh - 190px);
}

.ibr-load-error .ibr-stage::before {
    content: "The page-turn library could not be loaded.";
    padding: 2rem;
    color: var(--ibr-text);
}

.ibr-error {
    padding: .75rem 1rem;
    border-left: 4px solid currentColor;
}

@media (max-width: 700px) {
    .ibr-reader {
        padding: .65rem;
        border-radius: 6px;
    }

    .ibr-toolbar {
        gap: .4rem;
    }

    .ibr-button {
        min-height: 38px;
        padding: .5rem .65rem;
        font-size: 13px;
    }

    .ibr-counter {
        min-width: 68px;
        font-size: 13px;
    }

    .ibr-thumb {
        width: 60px;
    }
}
