@charset "utf-8";

:root {
    --primary: #173e70;
    --primary-dark: #0d294c;
    --gold: #c9a45c;
    --line: #dce4ee;
    --paper: #fffefb;
    --text: #243247;
    --muted: #6b7280;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light only;
    background: #edf2f7;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 10%, rgba(201,164,92,.14), transparent 32%),
        linear-gradient(145deg, #e9eef5, #f8fafc 48%, #e6ecf4);
    font-family: "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
}

button {
    font: inherit;
    cursor: pointer;
}

.epub-app {
    min-height: 100vh;
}

.epub-header {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(220px,1fr) auto minmax(220px,1fr);
    min-height: 76px;
    padding: 11px 23px;
    align-items: center;
    color: #fff;
    background: linear-gradient(120deg, var(--primary-dark), var(--primary));
    box-shadow: 0 8px 25px rgba(13,41,76,.24);
}

.epub-brand {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.epub-logo-circle {
    display: flex;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
}

.epub-logo {
    display: block;
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.epub-brand-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
}

.epub-brand-text strong {
    display: block;
    color: #fff;
    font-size: 16px;
    line-height: 1.25;
    white-space: nowrap;
}

.epub-brand-text small {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, .72);
    font-size: 9px;
    line-height: 1.2;
    letter-spacing: .12em;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: var(--gold);
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 50%;
}

.epub-brand strong,
.epub-brand small,
.epub-title strong,
.epub-title span {
    display: block;
}

.epub-brand small,
.epub-title span {
    margin-top: 2px;
    color: rgba(255,255,255,.66);
    font-size: 9px;
    letter-spacing: .14em;
}

.epub-title {
    text-align: center;
}

.epub-title strong {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-list {
    justify-self: end;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 8px;
    font-size: 21px;
    text-decoration: none;
}

.epub-main {
    position: relative;
    display: flex;
    min-height: calc(100vh - 76px);
    padding: 18px 18px 88px;
    justify-content: center;
}

.epub-reader-shell {
    position: relative;
    width: min(1280px, 100%);
    min-height: calc(100vh - 182px);
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 22px 60px rgba(13,41,76,.18);
}

.epub-viewer {
    width: 100%;
    height: calc(100vh - 182px);
    min-height: 520px;
}

.epub-status {
    position: absolute;
    top: 15px;
    left: 50%;
    z-index: 40;
    padding: 9px 14px;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(13,41,76,.92);
    border-radius: 999px;
    font-size: 12px;
    transition: opacity .2s;
}

.epub-status.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.epub-status.is-error {
    color: #8b1e1e;
    background: #fee2e2;
}

.page-area {
    position: absolute;
    top: 50%;
    z-index: 20;
    display: grid;
    width: 42px;
    height: 62px;
    padding: 0;
    place-items: center;
    transform: translateY(-50%);
    color: var(--primary);
    background: rgba(255,255,255,.86);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 8px 22px rgba(13,41,76,.10);
    font-size: 32px;
    opacity: .35;
}

.page-area:hover {
    opacity: 1;
}

.page-area-prev {
    left: 10px;
}

.page-area-next {
    right: 10px;
}

.epub-toolbar {
    position: fixed;
    right: 50%;
    bottom: 14px;
    z-index: 60;
    display: flex;
    min-height: 54px;
    padding: 7px 9px;
    align-items: center;
    gap: 6px;
    transform: translateX(50%);
    color: var(--text);
    background: rgba(255,255,255,.95);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 38px rgba(13,41,76,.17);
    backdrop-filter: blur(12px);
}

.epub-toolbar button {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 700;
}

.epub-toolbar button:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.location-label,
.font-label {
    min-width: 45px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.separator {
    width: 1px;
    height: 28px;
    background: var(--line);
}

.epub-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: min(360px, 90vw);
    height: 100vh;
    padding: 0;
    overflow: auto;
    transform: translateX(-105%);
    color: var(--text);
    background: #fff;
    box-shadow: 18px 0 44px rgba(13,41,76,.22);
    transition: transform .23s ease;
}

.epub-sidebar.is-open {
    transform: translateX(0);
}

.sidebar-head {
    position: sticky;
    top: 0;
    display: flex;
    min-height: 64px;
    padding: 0 18px;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: var(--primary);
}

.sidebar-head button {
    width: 36px;
    height: 36px;
    color: #fff;
    background: transparent;
    border: 0;
    font-size: 26px;
}

.toc-list {
    padding: 10px 0 30px;
}

.toc-link {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    color: var(--text);
    background: #fff;
    border: 0;
    border-bottom: 1px solid #eef2f6;
    text-align: left;
}

.toc-link:hover {
    color: var(--primary);
    background: #f4f7fb;
}

.epub-app[data-reader-theme="dark"] .epub-reader-shell {
    background: #17202b;
}

.epub-app:fullscreen {
    overflow: auto;
    background: #edf2f7;
}

.epub-app:fullscreen .epub-header {
    display: none;
}

.epub-app:fullscreen .epub-main {
    min-height: 100vh;
    padding-top: 10px;
}

.epub-app:fullscreen .epub-reader-shell,
.epub-app:fullscreen .epub-viewer {
    height: calc(100vh - 100px);
}

@media (max-width: 760px) {
    .epub-header {
        grid-template-columns: 1fr auto;
        min-height: 66px;
        padding: 9px 13px;
    }

    .epub-title {
        display: none;
    }

    .epub-brand strong {
        font-size: 15px;
    }

    .epub-main {
        min-height: calc(100vh - 66px);
        padding: 8px 7px 78px;
    }
   .epub-logo-circle {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .epub-logo {
        width: 39px;
        height: 39px;
    }

    .epub-brand {
        gap: 8px;
    }

    .epub-brand-text strong {
        font-size: 14px;
    }

    .epub-brand-text small {
        font-size: 8px;
        letter-spacing: .09em;
    }
    
    .epub-reader-shell {
        min-height: calc(100vh - 154px);
        border-radius: 8px;
    }

    .epub-viewer {
        height: calc(100vh - 154px);
        min-height: 440px;
    }

    .page-area {
        display: none;
    }

    .epub-toolbar {
        bottom: 8px;
        max-width: calc(100vw - 12px);
        gap: 3px;
        padding: 5px;
    }

    .epub-toolbar button {
        min-width: 34px;
        height: 36px;
        padding: 0 7px;
        font-size: 12px;
    }

    .font-label,
    .separator {
        display: none;
    }
}
