/* ==========================================================================
   作品页（轻小说 / 对话小说详情）
   --------------------------------------------------------------------------
   照 LifeLine 作品页的「一屏三栏」：作品信息 / 正文主体 / 评论。
   两侧「作品广告位」退到内容区外的页边，只有 ≥1500px 才出现（窄屏隐藏），
   这样中间三栏的宽度不会被广告挤压。只在本页加载。
   ========================================================================== */

.bh-work {
    padding: 18px 0 44px;
}

/* 页边广告 + 中间舞台：舞台固定 1180，广告落在两侧留白里 */
.bh-work__wrap {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr) 116px;
    gap: 20px;
    align-items: start;
}

.bh-work__stage {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr) 308px;
    gap: 18px;
    align-items: start;
}

/* ---------------------------------------------------------------- 左栏：信息 */
.bh-work__info {
    display: flex;
    flex-direction: column;
    padding: 14px;
    background: var(--bh-bg);
    border: 1px solid var(--bh-border-light);
    border-radius: var(--bh-radius-lg);
    box-shadow: var(--bh-shadow-sm);
}

.bh-work__cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(150deg, #f6d7dd, #d9a7b4);
}

.bh-work__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.bh-work__state {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: var(--bh-radius-pill);
    background: rgba(255, 255, 255, .92);
    font-size: 11px;
    line-height: 16px;
    color: var(--bh-text-sub);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.bh-work__state--done {
    color: #3f7a3f;
}

.bh-work__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 8px;
}

.bh-work__tag {
    padding: 2px 8px;
    font-size: 11px;
    line-height: 17px;
    border-radius: var(--bh-radius-xs);
    background: var(--bh-bg-section);
    color: var(--bh-text-sub);
}

.bh-work__tag--kind {
    background: var(--bh-primary-light);
    color: var(--bh-primary);
}

.bh-work__tag--gold {
    background: #fff7e8;
    color: #b06d00;
}

.bh-work__title {
    margin: 0 0 8px;
    font-size: 21px;
    line-height: 1.4;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--bh-text);
}

.bh-work__author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-muted);
}

.bh-work__avatar {
    position: relative;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bh-bg-section);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bh-work__avatar::after {
    content: attr(data-initial);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--bh-text-muted);
}

.bh-work__avatar img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bh-work__aname {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bh-text-sub);
}

/* 数据格：2 × 2，和 LifeLine 左栏的数字块同一节奏 */
.bh-work__nums {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 12px;
    padding: 10px 0;
    background: var(--bh-bg-section);
    border-radius: var(--bh-radius);
    overflow: hidden;
}

.bh-work__nums div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    border-left: 1px solid rgba(31, 32, 35, .05);
}

.bh-work__nums div:nth-child(odd) {
    border-left: 0;
}

.bh-work__nums dt {
    order: 2;
    font-size: 10.5px;
    color: var(--bh-text-muted);
}

.bh-work__nums dd {
    order: 1;
    margin: 0;
    font-size: var(--bh-fs-md);
    font-weight: 700;
    color: var(--bh-text);
    font-variant-numeric: tabular-nums;
}

.bh-work__descbox {
    margin-bottom: 12px;
}

.bh-work__subtitle {
    margin: 0 0 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .5px;
    color: var(--bh-text-muted);
}

.bh-work__desc {
    margin: 0;
    max-height: 132px;
    overflow-y: auto;
    scrollbar-width: thin;
    font-size: var(--bh-fs-xs);
    line-height: 1.85;
    color: var(--bh-text-sub);
}

.bh-work__acts {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bh-work .bh-btn--block {
    width: 100%;
    justify-content: center;
}

.bh-work__meta-small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--bh-text-placeholder);
}

.bh-work__meta-small a {
    color: var(--bh-text-placeholder);
    text-decoration: none;
}

.bh-work__meta-small a:hover {
    color: var(--bh-primary);
}

.bh-work__dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--bh-border);
}

/* ---------------------------------------------------------------- 中栏：正文 */
.bh-work__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bh-work__panel {
    padding: 16px 18px 18px;
    background: var(--bh-bg);
    border: 1px solid var(--bh-border-light);
    border-radius: var(--bh-radius-lg);
    box-shadow: var(--bh-shadow-sm);
}

.bh-work__phead {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--bh-border-light);
}

.bh-work__ptitle {
    margin: 0;
    font-size: var(--bh-fs-lg);
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--bh-text);
}

.bh-work__psub {
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-muted);
}

.bh-work__pmore {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--bh-primary);
    text-decoration: none;
    white-space: nowrap;
}

.bh-work__pmore:hover {
    color: var(--bh-primary-hover);
}

.bh-work__empty {
    margin: 0;
    padding: 26px 0;
    text-align: center;
    font-size: var(--bh-fs-sm);
    color: var(--bh-text-muted);
}

/* 目录：单列，超长内部滚动，底部渐隐避免半截行 */
.bh-work__toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 90%, rgba(0, 0, 0, .12) 100%);
    mask-image: linear-gradient(180deg, #000 0, #000 90%, rgba(0, 0, 0, .12) 100%);
}

.bh-work__toc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--bh-radius-sm);
    text-decoration: none;
    transition: var(--bh-transition);
}

.bh-work__toc-item:hover {
    background: var(--bh-bg-hover);
}

.bh-work__toc-no {
    flex: none;
    width: 22px;
    font-size: 11px;
    color: var(--bh-text-placeholder);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.bh-work__toc-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--bh-fs-sm);
    color: var(--bh-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bh-work__toc-item:hover .bh-work__toc-name {
    color: var(--bh-primary);
}

.bh-work__toc-words {
    flex: none;
    font-size: 11px;
    color: var(--bh-text-placeholder);
    font-variant-numeric: tabular-nums;
}

/* 试读正文 */
.bh-work__prose {
    font-size: var(--bh-fs-md);
    line-height: 2;
    color: var(--bh-text);
    max-height: 460px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.bh-work__prose p {
    margin: 0 0 10px;
    text-indent: 2em;
}

.bh-work__prose p:last-child {
    margin-bottom: 0;
}

.bh-chat--work {
    padding: 4px 6px 0;
    gap: 10px;
}

/* ---------------------------------------------------------------- 右栏：评论 */
.bh-work__cmt {
    position: sticky;
    top: calc(var(--bh-header-h) + 16px);
    display: flex;
    flex-direction: column;
    /* 评论少的作品也不该缩成一个小方块：给一个和左栏视觉匹配的最小高度 */
    min-height: 520px;
    max-height: calc(100vh - var(--bh-header-h) - 40px);
    padding: 14px 14px 12px;
    background: var(--bh-bg);
    border: 1px solid var(--bh-border-light);
    border-radius: var(--bh-radius-lg);
    box-shadow: var(--bh-shadow-sm);
}

.bh-work__phead--cmt {
    margin-bottom: 10px;
    padding-bottom: 10px;
}

/* 评论列表：整栏内部滚动，输入框固定在底部，和 LifeLine 的评论栏一致 */
.bh-wcmt {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.bh-wcmt__list {
    flex: 1 1 auto;
    min-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 2px;
}

.bh-wcmt__guest {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--bh-bg-section);
    border-radius: var(--bh-radius);
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-sub);
}

.bh-wcmt__guest p {
    margin: 0;
}

.bh-wcmt__form {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.bh-wcmt__avatar {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bh-bg-section);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bh-wcmt__avatar::after {
    content: attr(data-initial);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--bh-text-muted);
}

.bh-wcmt__avatar img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bh-wcmt__field {
    min-width: 0;
}

.bh-wcmt__input {
    display: block;
    width: 100%;
    min-height: 56px;
    padding: 8px 10px;
    font: inherit;
    font-size: var(--bh-fs-xs);
    line-height: 1.7;
    color: var(--bh-text);
    background: var(--bh-bg-input);
    border: 1px solid transparent;
    border-radius: var(--bh-radius);
    resize: none;
    transition: var(--bh-transition);
}

.bh-wcmt__input:focus {
    outline: none;
    background: var(--bh-bg);
    border-color: var(--bh-border);
}

.bh-wcmt__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.bh-wcmt__tip {
    font-size: 11px;
    color: #d33;
}

.bh-wcmt__list {
    margin-top: 2px;
}

/* 单条评论：沿用 new_comment 片段的结构，换成浅色、窄栏版式 */
.bh-work .media {
    margin: 0;
}

.bh-work .new-comment-body {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
        "thumb meta"
        "body  body";
    column-gap: 8px;
    row-gap: 4px;
    align-items: center;
    padding: 9px 0;
    border-top: 1px solid var(--bh-border-light);
}

.bh-work .comment-thumb {
    grid-area: thumb;
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bh-bg-section);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bh-work .comment-thumb::after {
    content: attr(data-initial);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--bh-text-muted);
}

.bh-work .comment-thumb img {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.bh-work .comment-meta {
    grid-area: meta;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.bh-work .comment-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.bh-work .new-comment-body .user-name {
    font-size: 11.5px;
    line-height: 1.3;
    font-weight: 500;
    color: var(--bh-text-sub);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}

.bh-work .comment-author-badge {
    flex: none;
    font-style: normal;
    font-size: 9.5px;
    line-height: 13px;
    padding: 0 3px;
    border: 1px solid var(--bh-primary);
    border-radius: 3px;
    color: var(--bh-primary);
}

.bh-work .comment-date {
    font-size: 10.5px;
    line-height: 1.2;
    color: var(--bh-text-placeholder);
    font-variant-numeric: tabular-nums;
}

.bh-work .new-comment-body .media-body {
    grid-area: body;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.bh-work .new-comment-body .media-body p {
    margin: 0;
}

.bh-work .comment_content {
    display: block;
    font-size: 12px;
    line-height: 1.7;
    color: var(--bh-text);
    word-break: break-word;
    white-space: pre-wrap;
}

.bh-wcmt__empty {
    margin: 0;
    padding: 28px 0;
    text-align: center;
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-muted);
}

.bh-wcmt__more {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 0;
    font: inherit;
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-sub);
    background: var(--bh-bg-section);
    border: 0;
    border-radius: var(--bh-radius);
    cursor: pointer;
    transition: var(--bh-transition);
}

.bh-wcmt__more span {
    color: var(--bh-text-placeholder);
    font-size: 11px;
}

.bh-wcmt__more:hover {
    background: var(--bh-bg-hover);
    color: var(--bh-primary);
}

.bh-wcmt__more[hidden] {
    display: none;
}

/* ---------------------------------------------------------------- 通栏：全部作品 */
.bh-work__all {
    margin-top: 22px;
    padding: 20px 0 26px;
    background: var(--bh-bg);
    border-top: 1px solid var(--bh-border-light);
}

.bh-work__allinner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

.bh-work__allhead {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 16px;
}

.bh-work__alltitle {
    margin: 0;
    font-size: var(--bh-fs-xl);
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--bh-text);
}

.bh-work__allsub {
    font-size: var(--bh-fs-xs);
    color: var(--bh-text-muted);
}

.bh-work__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.bh-work__tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    font-size: 12px;
    color: var(--bh-text-sub);
    background: var(--bh-bg-section);
    border-radius: var(--bh-radius-pill);
    text-decoration: none;
    transition: var(--bh-transition);
}

.bh-work__tab i {
    font-style: normal;
    font-size: 10.5px;
    color: var(--bh-text-placeholder);
    font-variant-numeric: tabular-nums;
}

.bh-work__tab:hover {
    color: var(--bh-primary);
    background: var(--bh-primary-light);
}

.bh-work__tab.is-active {
    background: var(--bh-primary);
    color: #fff;
}

.bh-work__tab.is-active i {
    color: rgba(255, 255, 255, .78);
}

.bh-work__allmore {
    font-size: 12.5px;
    color: var(--bh-primary);
    text-decoration: none;
    white-space: nowrap;
}

.bh-work__grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px 14px;
}

/* ---------------------------------------------------------------- 响应式 */
/* 广告位只在两侧还有余量时出现，否则整块让位给三栏 */
@media (max-width: 1499px) {
    .bh-work__wrap {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 24px;
    }

    .bh-work__wrap > .bh-ad-rail {
        display: none;
    }
}

/* 1180 以下：评论从右栏掉到正文下方 */
@media (max-width: 1179px) {
    .bh-work__stage {
        grid-template-columns: 264px minmax(0, 1fr);
    }

    .bh-work__cmt {
        position: static;
        grid-column: 1 / -1;
        /* 掉到正文下方后不再需要撑高度，否则评论少时留一大块空白 */
        min-height: 0;
        max-height: none;
    }

    .bh-wcmt__list {
        max-height: 420px;
    }

    .bh-work__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* 860 以下：单栏，信息卡横排在上，目录/试读/评论依次向下 */
@media (max-width: 859px) {
    .bh-work {
        padding: 12px 0 32px;
    }

    .bh-work__wrap,
    .bh-work__allinner {
        padding: 0 16px;
    }

    .bh-work__stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .bh-work__title {
        font-size: 19px;
    }

    .bh-work__desc {
        max-height: 96px;
    }

    .bh-work__toc {
        max-height: 300px;
    }

    .bh-work__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
