/* Cover.css — 電子型錄閱讀器 */

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

body {
    display: flex;
    flex-direction: column;
    background: #21262c;
    background: radial-gradient(ellipse at 50% -10%, #39424d 0%, #21262c 55%, #171a1e 100%);
    background-attachment: fixed;
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC",
                 -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

/* ---------- 舞台 ---------- */

.container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 84px 96px;
    overflow: hidden;
}

#book {
    margin: 0 auto;
    position: relative;
    cursor: default;
    transition: transform .25s ease;
    transform-origin: 50% 50%;
    will-change: transform;
}

#book.is-zoomed {
    cursor: grab;
    transition: transform .12s ease-out;
}

#book.is-zoomed:active {
    cursor: grabbing;
}

/* ---------- 內頁 ---------- */

#book .turn-page {
    background-color: #fff;
}

#book .cover {
    background: #fff;
}

.data,
#book .data {
    width: 100%;
    height: 100%;
}

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

.data canvas {
    width: 100%;
    height: 100%;
}

#book .odd {
    background-image: linear-gradient(to right, #FFF 95%, #ddd 100%);
}

#book .even {
    background-image: linear-gradient(to left, #FFF 95%, #ddd 100%);
}

/* ---------- 載入 / 錯誤 ---------- */

#book .loader {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(4, 40, 95, .15);
    border-top-color: #04285f;
    border-radius: 50%;
    animation: ec-spin .8s linear infinite;
}

@keyframes ec-spin {
    to { transform: rotate(360deg); }
}

.page-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9aa3ad;
    font-size: .9rem;
}

/* ---------- 控制項 ---------- */

.ec-ui button {
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: background-color .18s, color .18s, opacity .18s;
}

.ec-ui button:focus-visible {
    outline: 2px solid #6ea8ff;
    outline-offset: 2px;
}

/* 側邊翻頁鈕 */

.ec-nav {
    position: fixed;
    top: 50%;
    width: 54px;
    height: 54px;
    margin-top: -27px;
    border-radius: 50%;
    font-size: 1.75rem;
    background: rgba(18, 21, 25, .5);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
}

.ec-nav:hover {
    background: rgba(4, 40, 95, .85);
}

.ec-nav--prev { left: 18px; }
.ec-nav--next { right: 18px; }

/* 底部工具列 */

.ec-toolbar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(18, 21, 25, .82);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
}

.ec-toolbar button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1rem;
}

.ec-toolbar button:hover {
    background: rgba(255, 255, 255, .14);
}

.ec-toolbar__sep {
    width: 1px;
    height: 22px;
    margin: 0 6px;
    background: rgba(255, 255, 255, .16);
}

.ec-pages {
    padding: 0 10px;
    color: #e6e9ee;
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ec-pages b {
    font-weight: 600;
}

.ec-pages__sep {
    margin: 0 5px;
    color: rgba(255, 255, 255, .4);
}

.ec-toolbar .ec-zoom {
    width: auto;
    min-width: 56px;
    padding: 0 8px;
    border-radius: 999px;
    color: #e6e9ee;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- 平板 / 手機 ---------- */

@media (max-width: 900px) {
    .container {
        padding: 14px 14px 84px;
    }

    .ec-nav {
        width: 44px;
        height: 44px;
        margin-top: -22px;
        font-size: 1.4rem;
    }

    .ec-nav--prev { left: 8px; }
    .ec-nav--next { right: 8px; }

    .ec-toolbar {
        bottom: 12px;
        gap: 0;
        padding: 5px;
    }

    .ec-toolbar button {
        width: 34px;
        height: 34px;
        font-size: .9rem;
    }

    .ec-toolbar__sep {
        margin: 0 3px;
    }

    .ec-pages {
        padding: 0 6px;
        font-size: .8rem;
    }
}

@media (max-width: 400px) {
    .ec-toolbar .ec-zoom {
        display: none;
    }
}

/* 橫向且高度很矮（手機橫拿） */

@media (orientation: landscape) and (max-height: 500px) {
    .container {
        padding: 8px 60px 60px;
    }

    .ec-toolbar {
        bottom: 8px;
    }
}
