﻿body .laypopchap {
    max-width: calc(100vw - 32px) !important;
    border-radius: 24px !important;
    overflow: hidden;
    background: #fffaf2 !important;
    box-shadow: 0 28px 90px rgba(35, 24, 14, 0.34) !important;
}

body .laypopchap .layui-layer-content {
    max-height: min(78vh, 720px);
    padding: 0 !important;
    overflow: hidden !important;
    background: #fffaf2;
}

.chapterMenuPopup {
    --chapter-menu-text: #2f261f;
    --chapter-menu-muted: #7b6a58;
    --chapter-menu-soft: #fff6e8;
    --chapter-menu-line: rgba(124, 82, 42, 0.14);
    --chapter-menu-accent: #c87924;
    --chapter-menu-accent-strong: #915716;
    width: 100%;
    color: var(--chapter-menu-text);
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 226, 174, 0.92), transparent 31%),
        linear-gradient(180deg, #fffaf2 0%, #fffdf8 100%);
}

.chapterMenuPopupHeader {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--chapter-menu-line);
}

.chapterMenuPopupEyebrow {
    margin-bottom: 8px;
    color: var(--chapter-menu-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.chapterMenuPopupTitleRow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.chapterMenuPopupTitleGroup {
    min-width: 0;
}

.chapterMenuPopupTitleGroup h2 {
    margin: 0;
    color: var(--chapter-menu-text);
    font-size: 26px;
    font-weight: 950;
    line-height: 1.15;
}

.chapterMenuPopupTitleGroup p {
    max-width: 52ch;
    margin: 8px 0 0;
    color: var(--chapter-menu-muted);
    font-size: 14px;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapterMenuPopupClose {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(124, 82, 42, 0.18);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.86);
    color: var(--chapter-menu-muted);
    cursor: pointer;
    transition: transform 180ms ease, color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.chapterMenuPopupClose:hover,
.chapterMenuPopupClose:focus-visible {
    border-color: rgba(200, 121, 36, 0.38);
    background: #ffffff;
    color: var(--chapter-menu-accent-strong);
    transform: translateY(-1px);
    outline: none;
}

.chapterMenuPopupMeta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.chapterMenuPopupMeta span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(200, 121, 36, 0.16);
    border-radius: 999px;
    background: rgba(255, 246, 232, 0.82);
    color: var(--chapter-menu-muted);
    font-size: 13px;
    font-weight: 800;
}

.chapterMenuPopupBody {
    max-height: min(58vh, 520px);
    overflow: auto;
    padding: 18px 22px 24px;
}

.chapterMenuPopupBody::-webkit-scrollbar {
    width: 8px;
}

.chapterMenuPopupBody::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(145, 87, 22, 0.28);
}

.chapterMenuPopupList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chapterMenuPopupList li {
    min-width: 0;
}

.chapterMenuPopupList a {
    min-height: 58px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--chapter-menu-line);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.82);
    color: var(--chapter-menu-text);
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(84, 55, 26, 0.05);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.chapterMenuPopupList a:hover,
.chapterMenuPopupList a:focus-visible {
    border-color: rgba(200, 121, 36, 0.32);
    background: #fffdf8;
    box-shadow: 0 14px 30px rgba(84, 55, 26, 0.1);
    transform: translateY(-1px);
    outline: none;
}

.chapterMenuPopupList .is-active a {
    border-color: rgba(200, 121, 36, 0.5);
    background: linear-gradient(135deg, rgba(255, 246, 232, 0.98), rgba(255, 231, 194, 0.76));
}

.chapterMenuPopupList .is-locked a {
    color: #8a7b6b;
    background: rgba(247, 241, 232, 0.72);
}

.chapterMenuPopupIndex {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: rgba(200, 121, 36, 0.1);
    color: var(--chapter-menu-accent-strong);
    font-size: 14px;
    font-weight: 950;
}

.chapterMenuPopupName {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 15px;
    font-weight: 850;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapterMenuPopupCurrent,
.chapterMenuPopupLock {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.chapterMenuPopupCurrent {
    background: rgba(200, 121, 36, 0.14);
    color: var(--chapter-menu-accent-strong);
}

.chapterMenuPopupLock {
    background: rgba(116, 100, 84, 0.1);
    color: #8a7b6b;
}

.chapterMenuPopupState {
    min-height: 210px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    color: var(--chapter-menu-muted);
}

.chapterMenuPopupState span {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(200, 121, 36, 0.14);
    border-top-color: var(--chapter-menu-accent);
    border-radius: 999px;
    animation: chapterMenuSpin 850ms linear infinite;
}

.chapterMenuPopup.is-empty .chapterMenuPopupState span,
.chapterMenuPopup.is-error .chapterMenuPopupState span {
    animation: none;
    border-color: rgba(200, 121, 36, 0.18);
    background: rgba(200, 121, 36, 0.08);
}

.chapterMenuPopupState strong {
    font-size: 15px;
    font-weight: 900;
}

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

@media (max-width: 760px) {
    body .laypopchap {
        width: calc(100vw - 20px) !important;
        border-radius: 20px !important;
    }

    body .laypopchap .layui-layer-content {
        max-height: 82vh;
    }

    .chapterMenuPopupHeader {
        padding: 20px 18px 15px;
    }

    .chapterMenuPopupTitleGroup h2 {
        font-size: 22px;
    }

    .chapterMenuPopupTitleGroup p {
        max-width: calc(100vw - 120px);
        font-size: 13px;
    }

    .chapterMenuPopupClose {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .chapterMenuPopupBody {
        max-height: 60vh;
        padding: 14px 14px 18px;
    }

    .chapterMenuPopupList {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chapterMenuPopupList a {
        min-height: 54px;
        grid-template-columns: 38px minmax(0, 1fr) auto;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .chapterMenuPopupIndex {
        width: 34px;
        height: 34px;
        border-radius: 12px;
    }

    .chapterMenuPopupName {
        font-size: 14px;
    }

    .chapterMenuPopupCurrent,
    .chapterMenuPopupLock {
        min-height: 24px;
        padding: 0 8px;
        font-size: 11px;
    }
}

body.black .laypopchap {
    background: #17110c !important;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62) !important;
}

body.black .laypopchap .layui-layer-content {
    background: #17110c;
}

body.black .chapterMenuPopup {
    --chapter-menu-text: #f8eddf;
    --chapter-menu-muted: #ceb59a;
    --chapter-menu-soft: #241910;
    --chapter-menu-line: rgba(255, 214, 166, 0.14);
    --chapter-menu-accent: #f2a45b;
    --chapter-menu-accent-strong: #ffbd72;
    background:
        radial-gradient(circle at 12% 0%, rgba(171, 97, 32, 0.28), transparent 32%),
        linear-gradient(180deg, #1d160f 0%, #120e0a 100%);
}

body.black .chapterMenuPopupHeader {
    border-color: var(--chapter-menu-line);
}

body.black .chapterMenuPopupTitleGroup h2,
body.black .chapterMenuPopupName,
body.black .chapterMenuPopupState strong {
    color: var(--chapter-menu-text);
}

body.black .chapterMenuPopupTitleGroup p,
body.black .chapterMenuPopupMeta span,
body.black .chapterMenuPopupState {
    color: var(--chapter-menu-muted);
}

body.black .chapterMenuPopupClose,
body.black .chapterMenuPopupMeta span,
body.black .chapterMenuPopupList a {
    border-color: rgba(255, 214, 166, 0.14);
    background: rgba(36, 25, 16, 0.84);
}

body.black .chapterMenuPopupClose:hover,
body.black .chapterMenuPopupClose:focus-visible,
body.black .chapterMenuPopupList a:hover,
body.black .chapterMenuPopupList a:focus-visible {
    border-color: rgba(255, 184, 111, 0.38);
    background: rgba(48, 33, 21, 0.96);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
}

body.black .chapterMenuPopupList .is-active a {
    border-color: rgba(255, 184, 111, 0.48);
    background: linear-gradient(135deg, rgba(68, 42, 21, 0.96), rgba(45, 30, 18, 0.96));
}

body.black .chapterMenuPopupList .is-locked a {
    color: #a9947e;
    background: rgba(30, 22, 15, 0.72);
}

body.black .chapterMenuPopupIndex,
body.black .chapterMenuPopupCurrent {
    background: rgba(242, 164, 91, 0.14);
    color: #ffc98f;
}

body.black .chapterMenuPopupLock {
    background: rgba(255, 214, 166, 0.08);
    color: #ad9780;
}
