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

body.wk-ebook-body {
    overflow: hidden;
    font-family: Apple SD Gothic Neo, Pretendard, Malgun Gothic, sans-serif;
    background: #081225;
    color: #ffffff;
    overscroll-behavior: none;
}

.wk-ebook-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(circle at top, rgba(35, 69, 128, 0.28), transparent 44%),
        linear-gradient(180deg, #081225 0%, #07101e 100%);
}

.wk-ebook-topbar {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    padding: 12px 18px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(4, 10, 22, 0.94);
}

.wk-ebook-topbar__left,
.wk-ebook-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wk-ebook-topbar__left {
    flex: 1 1 auto;
}

.wk-ebook-topbar__right {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wk-ebook-title {
    margin: 0;
    color: #ffffff;
    font-size: clamp(18px, 2vw, 28px);
    line-height: 1.24;
    font-weight: 800;
}

.wk-ebook-headline {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.45;
}

.wk-ebook-btn,
.wk-ebook-zoom-state,
.wk-ebook-page-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
}

.wk-ebook-btn {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 24, 39, 0.9);
    color: #ffffff;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, opacity .16s ease;
}

.wk-ebook-btn:hover:not(:disabled) {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(255, 255, 255, 0.16);
}

.wk-ebook-btn:disabled {
    opacity: .4;
    cursor: default;
}

.wk-ebook-btn--primary {
    background: #89c53f;
    border-color: #89c53f;
    color: #132018;
}

.wk-ebook-btn--primary:hover:not(:disabled) {
    background: #9bd84d;
    border-color: #9bd84d;
}

.wk-ebook-zoom-state,
.wk-ebook-page-state {
    min-width: 70px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 24, 39, 0.9);
    color: #ffffff;
}

.wk-ebook-alert {
    margin: 14px 18px 0;
    padding: 14px 16px;
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-radius: 14px;
    background: rgba(127, 29, 29, 0.24);
    color: #fecaca;
    font-size: 14px;
}

.wk-ebook-stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.wk-ebook-loading,
.wk-ebook-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.wk-ebook-loading {
    background: rgba(5, 10, 20, 0.6);
}

.wk-ebook-loading.is-hidden,
.wk-ebook-overlay[hidden] {
    display: none;
}

.wk-ebook-overlay {
    background: rgba(4, 9, 20, 0.76);
    backdrop-filter: blur(8px);
}

.wk-ebook-overlay__card {
    width: min(100%, 480px);
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    background: rgba(8, 18, 37, 0.96);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

.wk-ebook-overlay__eyebrow {
    margin: 0 0 10px;
    color: #8dc63f;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.wk-ebook-overlay__card h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

.wk-ebook-overlay__card p {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.7;
}

.wk-ebook-overlay__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.wk-ebook-spinner {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top-color: #8cc63f;
    animation: wkEbookSpin 0.9s linear infinite;
}

#wkLoadingText {
    margin: 14px 0 0;
    text-align: center;
    color: #ffffff;
}

@keyframes wkEbookSpin {
    to {
        transform: rotate(360deg);
    }
}

.wk-ebook-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: none;
    background: transparent;
}

.wk-ebook-viewport.is-zoomed {
    cursor: grab;
}

.wk-ebook-viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.wk-ebook-surface {
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.wk-ebook-spread {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
}

.wk-ebook-spread.is-single {
    gap: 0;
}

.wk-ebook-page {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #ffffff;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(3, 10, 20, 0.42);
    cursor: pointer;
}

.wk-ebook-spread:not(.is-single) .wk-ebook-page {
    border-radius: 0;
}

.wk-ebook-spread:not(.is-single) .wk-ebook-page:first-child {
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
    box-shadow: -18px 24px 40px rgba(3, 10, 20, 0.3);
}

.wk-ebook-spread:not(.is-single) .wk-ebook-page:last-child {
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
    box-shadow: 18px 24px 40px rgba(3, 10, 20, 0.3);
}

.wk-ebook-viewport.is-zoomed .wk-ebook-page {
    cursor: inherit;
}

.wk-ebook-page canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #ffffff;
}

.wk-ebook-page--cover {
    box-shadow: 0 30px 58px rgba(3, 10, 20, 0.5);
}

body.wk-ebook-body--embedded .wk-ebook-overlay {
    display: none !important;
}

@media (max-width: 1100px) {
    .wk-ebook-topbar {
        align-items: flex-start;
    }

    .wk-ebook-topbar__right {
        max-width: 60%;
    }
}

@media (max-width: 820px) {
    .wk-ebook-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .wk-ebook-topbar__right {
        max-width: none;
        justify-content: flex-start;
    }

    .wk-ebook-surface {
        padding: 16px;
    }

    .wk-ebook-spread {
        gap: 0;
    }
}

@media (max-width: 560px) {
    .wk-ebook-btn,
    .wk-ebook-zoom-state,
    .wk-ebook-page-state {
        min-height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }

    .wk-ebook-title {
        font-size: 19px;
    }

    .wk-ebook-headline {
        font-size: 11px;
    }

    .wk-ebook-overlay__card {
        padding: 22px;
    }

    .wk-ebook-surface {
        padding: 12px;
    }
}
