.center {
    display: block;
    padding-top: 5px;
    padding-bottom: 5px;
    margin-left: auto;
    margin-right: auto;
    width: 50%;
}

/* ── Wrapper ── */
.comic-wrapper {
    max-width: 100%;
    background-color: rgb(15, 15, 18);
    min-height: 50vh;
    padding-top: 0;
}

/* ── Control panels ── */
.control-panel,
.control-panel-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: #202221;
    border: 1px solid rgba(127, 255, 212, 0.192);
    padding: 6px 12px;
    box-sizing: border-box;
}

.control-section {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-left  { flex: 1; justify-content: flex-start; }
.control-center { flex: 1; justify-content: center; }
.control-right { flex: 1; justify-content: flex-end; }

.page-indicator {
    font-family: "jf_dot_ayu";
    font-size: 13px;
    color: aquamarine;
    white-space: nowrap;
    padding: 0 8px;
}

.ctrl-btn {
    font-family: "jf_dot_ayu";
    font-size: 16px;
    background: none;
    border: 1px solid rgba(127, 255, 212, 0.2);
    color: aquamarine;
    padding: 2px 8px;
    cursor: pointer;
    border-radius: 2px;
    line-height: 1.4;
    transition: background-color 0.12s;
}

.ctrl-btn:hover {
    background-color: rgba(127, 255, 212, 0.1);
}

/* Style selects and buttons inside control panels */
.control-panel select,
.control-panel-bottom select,
.control-panel button,
.control-panel-bottom button {
    font-family: "jf_dot_ayu";
    font-size: 12px;
    background-color: #151616;
    border: 1px solid rgba(127, 255, 212, 0.2);
    color: aquamarine;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 2px;
}

.control-panel select:focus,
.control-panel-bottom select:focus {
    outline: none;
    border-color: rgba(127, 255, 212, 0.5);
}

.control-panel button:hover,
.control-panel-bottom button:hover {
    background-color: rgba(127, 255, 212, 0.1);
}

/* ── Comic container ── */
.comic-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.comic-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    margin: auto;
    user-select: none;
    background-color: rgb(15, 15, 18);
    padding: 20px 0;
}

.carousel-slide {
    display: flex;
    align-items: center;
}

.carousel-image {
    display: none;
    visibility: hidden;
    max-width: 1080px;
    width: auto;
    height: auto;
    pointer-events: none;
}

.carousel-overlay {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
}

.prev-overlay { left: 0; }
.next-overlay { right: 0; }

.carousel-overlay:hover { opacity: 0.5; }

/* ── Loading overlay ── */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.685);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    border-top: 4px solid rgb(26, 238, 210);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    border: 1px solid rgba(127, 255, 212, 0.192);
    background-color: #151616;
    padding: 20px;
    border-radius: 1px;
    text-align: center;
    width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.login-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 20px;
}

/* ── Locked pages notice ── */
.locked-notice {
    margin: 12px auto;
    max-width: 800px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 212, 59, 0.5);
    background-color: rgba(255, 212, 59, 0.08);
    color: #ffd43b;
    font-family: "jf_dot_ayu";
    font-size: 14px;
    text-align: center;
}
.locked-notice strong { color: #ffd43b; }
.locked-notice a { color: aquamarine; margin-left: 6px; }
.modal-link-button {
    background: none;
    border: none;
    color: #999;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
}

/* name of the extra set (Sketches, Textless, ...) shown in place of the chapter dropdown */
.reader-set-label {
    font-family: "jf_dot_ayu";
    font-size: 13px;
    color: aquamarine;
    padding: 0 8px;
}

/* ── Page turning by tapping/clicking the sides: nothing visible (no highlight, no hover tint) ── */
.carousel-overlay, .carousel-container, .carousel-image {
    -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; outline: none;
}
.carousel-overlay:hover { opacity: 0; }

/* ── Reader settings (phones): slim bar + cog; the controls live in a panel ── */
.cv-mini-page, .cv-cog, .cv-tools, .cv-tools-backdrop { display: none; }
@media (max-width: 700px) {
    /* the slim bar sits at the bottom of the screen */
    :root { --cv-bar: calc(52px + env(safe-area-inset-bottom)); }
    .control-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
        padding: 0 4px env(safe-area-inset-bottom) 6px; min-height: var(--cv-bar); gap: 8px;
        border-width: 1px 0 0; box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.4);
    }
    /* start right under the top menu (the page's placeholder header only fits the desktop menu) */
    .main-content > header, body > header { display: none; }
    .comic-wrapper { padding-top: var(--nav-h); padding-bottom: var(--cv-bar); }

    /* each page fitted between the top menu and the bar, centred when it's shorter than that */
    .carousel-container {
        display: flex; align-items: center; justify-content: center; box-sizing: border-box;
        padding: 8px 0; min-height: calc(100vh - var(--nav-h) - var(--cv-bar));
        min-height: calc(100svh - var(--nav-h) - var(--cv-bar));
    }
    .carousel-slide { width: 100%; justify-content: center; }
    .cv-fit .carousel-image {
        width: auto !important; height: auto !important; max-width: 100% !important;
        max-height: calc(100vh - var(--nav-h) - var(--cv-bar) - 16px);
        max-height: calc(100svh - var(--nav-h) - var(--cv-bar) - 16px);
    }
    .control-panel .control-left { flex: 0 0 auto; }
    .control-panel .control-left .ctrl-btn { font-size: 20px; padding: 6px 14px; }
    .reader-set-label { font-size: 14px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cv-mini-page { display: block; flex: 1; text-align: center; font-family: "jf_dot_ayu"; font-size: 16px; color: aquamarine; white-space: nowrap; }
    .cv-cog {
        display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0;
        color: aquamarine; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .control-panel-bottom { display: none; }   /* the top bar stays on screen instead */

    .cv-tools-backdrop { display: block; position: fixed; inset: 0; z-index: 1300; background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.2s; }
    .cv-tools-backdrop.is-open { opacity: 1; }
    .cv-tools {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400;
        max-height: 86vh; max-height: 86svh; overflow-y: auto;
        background: #1b1d1c; border-top: 1px solid rgba(127, 255, 212, 0.35);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6); padding: 4px 14px calc(18px + env(safe-area-inset-bottom));
        font-family: "jf_dot_ayu"; color: #ddd;
        transform: translateY(100%); transition: transform 0.2s ease-out;
    }
    .cv-tools.is-open { transform: none; }
    .cv-tools[hidden], .cv-tools-backdrop[hidden] { display: none; }
    @media (prefers-reduced-motion: reduce) { .cv-tools, .cv-tools-backdrop { transition: none; } }
    .cv-tools-head { display: flex; align-items: center; justify-content: space-between; }
    .cv-tools-head h2 { margin: 0; font-size: 19px; font-weight: normal; color: #eee; letter-spacing: 1px; }
    .cv-tools-close { width: 48px; height: 48px; font-size: 30px; line-height: 1; color: #aaa; background: none; border: none; cursor: pointer; }
    .cv-tools-row { padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
    .cv-tools-row[hidden] { display: none; }
    .cv-tools-label { display: block; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #8a8f8c; margin-bottom: 8px; }
    .cv-tools .control-section { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
    .cv-tools .control-center { justify-content: space-between; flex-wrap: nowrap; }
    .cv-tools select, .cv-tools .ctrl-btn, .cv-tools .control-right button {
        font-family: "jf_dot_ayu"; color: aquamarine; background-color: #151616;
        border: 1px solid rgba(127, 255, 212, 0.3); border-radius: 0; cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .cv-tools select { width: 100%; height: 46px; font-size: 16px; padding: 0 10px; }
    .cv-tools .ctrl-btn, .cv-tools .control-right button { min-width: 46px; height: 46px; font-size: 18px; padding: 0 12px; }
    .cv-tools .ctrl-btn:active, .cv-tools .control-right button:active { background-color: rgba(127, 255, 212, 0.12); }
    .cv-tools .page-indicator { font-size: 15px; }
    .cv-tools .control-right button { flex: 1 1 auto; font-size: 15px; }
    .cv-tools #viewToggle { flex: 1 1 100%; }
}

/* All Pages: previous / next chapter, above and below the pages */
.cv-chapter-nav { display: flex; justify-content: space-between; gap: 10px; max-width: 1080px; margin: 0 auto; padding: 12px; box-sizing: border-box; }
.cv-chapter-nav[hidden] { display: none; }
.cv-ch-btn {
    font-family: "jf_dot_ayu"; font-size: 15px; color: aquamarine; background: #151616;
    border: 1px solid rgba(127, 255, 212, 0.35); border-radius: 0; padding: 12px 16px; cursor: pointer;
    max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cv-ch-btn:hover { background: rgba(127, 255, 212, 0.1); }
.cv-ch-btn[data-ch-step="1"] { margin-left: auto; }
.cv-ch-btn.cv-ch-locked { color: #ffd43b; border-color: rgba(255, 212, 59, 0.45); }
@media (max-width: 700px) { .cv-ch-btn { flex: 1 1 0; max-width: none; padding: 14px 10px; } }
