:root { --mv-bg: #0b0c12; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--mv-bg);
    color: #fff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.material-viewer__wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    touch-action: none;
}

.material-viewer__wrap.is-zoomed {
    padding: 0;
}

.material-viewer__wrap.is-ready .material-viewer__book,
.material-viewer__wrap.is-ready .previous-button,
.material-viewer__wrap.is-ready .next-button {
    opacity: 1;
    pointer-events: auto;
}

.material-viewer__wrap.is-ready ~ .material-viewer__toolbar {
    opacity: 1;
    pointer-events: auto;
}

.material-viewer__book-shell {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
    background: var(--mv-bg);
}

.material-viewer__book {
    position: relative;
    background: var(--mv-bg);
    box-shadow: none;
    overflow: visible !important;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    opacity: 0;
    transition: opacity 220ms ease;
}

.material-viewer__book,
.material-viewer__book .page-wrapper,
.material-viewer__book .page,
.turn-page,
.turn-page img {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.material-viewer__book .page-wrapper,
.material-viewer__book .page {
    margin: 0 !important;
    padding: 0 !important;
}

.material-viewer__book.animated {
    transition: margin-left 0.5s ease;
}

.turn-page {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    background: #fff;
    transform-style: preserve-3d;
}
.turn-page .front,
.turn-page .back {
    background: #fff !important;
}
@media (max-width: 1200px) {
    .material-viewer__book .page,
    .material-viewer__book .page > div {
        background: #fff !important;
    }
}

.turn-page img,
.turn-page .gradient {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.turn-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    transform: rotateY(180deg) translateZ(1px);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    z-index: 3;
}
.turn-page img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
    transform: translateZ(0);
    z-index: 1;
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.material-viewer__book .shadow {
    pointer-events: none;
    transition: box-shadow 0.5s;
    box-shadow: 0 0 20px rgba(0,0,0,0.45);
}

.material-viewer__book .gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.material-viewer__book .even .gradient {
    background: linear-gradient(to right, rgba(0,0,0,0) 95%, rgba(0,0,0,0.2) 100%);
}

.material-viewer__book .odd .gradient {
    background: linear-gradient(to left, rgba(0,0,0,0) 95%, rgba(0,0,0,0.15) 100%);
}

.material-viewer__book.shadow .gradient {
    display: none;
}

.previous-button,
.next-button {
    position: fixed;
    top: 50%;
    width: 46px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000005;
    color: rgba(255,255,255,0.9);
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 0 14px 14px 0;
    transform: translateY(-50%);
    box-shadow: 0 10px 32px rgba(0,0,0,0.38), 0 0 0 1px rgba(255,255,255,0.04);
    opacity: 0;
    transition: opacity 180ms ease, background 160ms ease, box-shadow 160ms ease, transform 140ms ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.previous-button {
    left: 10px;
    border-radius: 14px 0 0 14px;
}

.next-button { right: 10px; }

.previous-button:hover,
.next-button:hover {
    background: rgba(255,255,255,0.12);
    box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.08);
}

.previous-button:active,
.next-button:active {
    transform: translateY(-50%) scale(0.97);
}

.previous-button:focus-visible,
.next-button:focus-visible {
    outline: 2px solid #7ec7ff;
    outline-offset: 2px;
}

.previous-button::after,
.next-button::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-left: 0;
    border-top: 0;
    transform: rotate(-45deg);
}

.previous-button::after { transform: rotate(135deg); }

.material-viewer__toolbar {
    position: fixed;
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 11, 17, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 8px;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    z-index: 1000006;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.material-viewer__icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.material-viewer__icon-btn:hover { background: rgba(255,255,255,0.12); }

.material-viewer__page-input {
    width: 40px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    background: rgba(0,0,0,0.35);
    color: #fff;
    padding: 3px 6px;
    text-align: center;
}

.material-viewer__status { color: rgba(255,255,255,0.8); }

.material-viewer__loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--mv-bg);
    background-blend-mode: screen;
    backdrop-filter: blur(2px);
    color: #fff;
    z-index: 5;
}

.material-viewer__error { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background: rgba(0,0,0,0.85); color:#ffb199; z-index:6; }
.material-viewer__error[hidden]{display:none!important;}

.material-viewer__loader-stack {
    position: relative;
    width: 200px;
    height: 140px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
}

.material-viewer__loader-stack span {
    display: none;
}

.material-viewer__loader-thumb {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 70px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
    background: #fff;
    opacity: 0;
    transform: translate(calc(-50% + var(--thumb-x0, 0px)), var(--thumb-y0, -70px)) rotate(var(--thumb-rot0, -10deg)) scale(var(--thumb-scale, 1));
    animation: thumb-drop var(--thumb-duration, 650ms) cubic-bezier(0.18, 0.9, 0.2, 1) forwards;
    animation-delay: calc((var(--drop-seq, 0) * 70ms) + var(--thumb-delay-jitter, 0ms));
    will-change: transform, opacity;
}

@keyframes thumb-drop {
    0%   { opacity: 0; transform: translate(calc(-50% + var(--thumb-x0, 0px)), var(--thumb-y0, -70px)) rotate(var(--thumb-rot0, -10deg)) scale(var(--thumb-scale, 1)); }
    55%  { opacity: 1; transform: translate(calc(-50% + var(--thumb-x1, 0px)), 10px) rotate(var(--thumb-rot1, 6deg)) scale(var(--thumb-scale, 1)); }
    100% { opacity: 1; transform: translate(calc(-50% + var(--thumb-x1, 0px)), 0) rotate(var(--thumb-rot1, 6deg)) scale(var(--thumb-scale, 1)); }
}

@media (max-width: 768px) {
    .material-viewer__wrap { gap: 12px; padding: 12px; }
    .material-viewer__book { width: 100%; max-width: none; }
    .material-viewer__title { max-width: 100%; }
    .material-viewer__toolbar {
        left: 50%;
        right: auto;
        bottom: 12px;
        transform: translateX(-50%);
        justify-content: center;
    }
    .previous-button,
    .next-button {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
}
