.bolon-flipbook {
    width: 100%;
    max-width: 1500px;
    margin: 30px auto;
    font-family: inherit;
    color: #222;
}

.bolon-flipbook * { box-sizing: border-box; }

.bf-toolbar {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 auto 12px;
    padding: 7px 9px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 8px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 5px 22px rgba(0,0,0,.08);
}

.bf-btn {
    appearance: none;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    color: #222;
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.bf-btn:hover { background: #f3f3f3; }
.bf-btn:active { transform: scale(.95); }
.bf-btn:disabled { opacity: .35; cursor: default; transform: none; }

.bf-page-indicator {
    min-width: 68px;
    text-align: center;
    font-size: 13px;
    letter-spacing: .02em;
}

.bf-spacer {
    width: 1px;
    height: 22px;
    background: rgba(0,0,0,.12);
    margin: 0 3px;
}

.bf-stage {
    position: relative;
    width: 100%;
    height: var(--bf-height);
    min-height: 520px;
    max-height: 900px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 2200px;
    background: #e9e9e7;
    border-radius: 4px;
    box-shadow: 0 15px 45px rgba(0,0,0,.16);
}

.bf-book {
    position: relative;
    width: min(96%, 1380px);
    height: 96%;
    max-height: 850px;
    display: flex;
    justify-content: center;
    align-items: stretch;
    transform-style: preserve-3d;
}

.bf-page {
    position: relative;
    width: 50%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    z-index: 2;
}
.bf-left { border-radius: 3px 0 0 3px; }
.bf-right { border-radius: 0 3px 3px 0; }

.bf-page canvas,
.bf-turn canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.bf-page canvas {
    transform-origin: center center;
    transition: transform .2s ease;
}

.bf-turn {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    z-index: 5;
    visibility: hidden;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    box-shadow: 0 8px 28px rgba(0,0,0,.22);
}

.bf-turn-forward {
    left: 50%;
    transform-origin: left center;
}
.bf-turn-backward {
    left: 0;
    transform-origin: right center;
}

.bf-turn.is-active {
    visibility: visible;
}

.bf-turn.forward-animate {
    animation: bfForward .65s cubic-bezier(.22,.61,.36,1) forwards;
}
.bf-turn.backward-animate {
    animation: bfBackward .65s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes bfForward {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-180deg); }
}
@keyframes bfBackward {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(180deg); }
}

.bf-loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #e9e9e7;
}

.bf-stage.is-loading .bf-book { opacity: 0; }

.bf-stage.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    min-height: 0;
    z-index: 999999;
    border-radius: 0;
}
.bf-stage.is-fullscreen .bf-book { width: 96vw; height: 91vh; max-height: none; }
.bf-stage.is-fullscreen .bf-loading { background: #e9e9e7; }

@media (max-width: 800px) {
    .bf-stage {
        min-height: 420px;
        height: min(76vh, 760px);
    }
    .bf-book { width: min(94%, 700px); height: 96%; }
    .bf-page { width: 100%; }
    .bf-left { display: none; }
    .bf-right { border-radius: 3px; }
    .bf-turn { width: 100%; left: 0; }
    .bf-turn-forward { transform-origin: left center; }
    .bf-turn-backward { transform-origin: right center; }
    .bf-toolbar { gap: 4px; padding: 6px; }
    .bf-btn { min-width: 32px; height: 32px; padding: 0 7px; }
    .bf-spacer { margin: 0 1px; }
}

@media (max-width: 480px) {
    .bolon-flipbook { margin: 18px auto; }
    .bf-toolbar { width: 100%; justify-content: center; }
    .bf-page-indicator { min-width: 54px; }
    .bf-stage { min-height: 390px; height: 72vh; border-radius: 0; }
}
