/* ==========================================================================
   首页「热门小说」区块
   ========================================================================== */

.index-web-section.txdh-novel-section {
    padding-bottom: 16px;
}

.index-web-section.txdh-novel-section .txdh-novel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    height: auto;
    min-height: 32px;
    margin: 0 0 12px;
    overflow: visible;
}

.index-web-section.txdh-novel-section .txdh-novel-title h3 {
    flex: none;
    margin: 0;
    padding-left: 14px;
    line-height: 32px;
    font-size: 17px;
    color: #333;
}

.index-web-section.txdh-novel-section .txdh-novel-title h3:before {
    top: 7px;
    height: 18px;
}

/* ------------------------------ 周榜 / 月榜 / 总榜 ------------------------------ */
.txdh-novel-period {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 2px;
    border-radius: 16px;
    background: #f2f5f7;
}

.txdh-novel-period button {
    margin: 0;
    padding: 4px 14px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: #7c8794;
    font-size: 13px;
    font-family: inherit;
    line-height: 18px;
    cursor: pointer;
    outline: none;
    transition: background .2s ease, color .2s ease;
}

.txdh-novel-period button:hover {
    color: #20c4ab;
}

.txdh-novel-period button.active {
    background: #20c4ab;
    color: #fff;
    font-weight: 600;
}

/* ------------------------------ 分类 ------------------------------ */
.txdh-novel-cats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin: 0 0 14px;
}

.txdh-novel-cats button {
    margin: 0;
    padding: 3px 14px;
    border: 1px solid #e3e7ec;
    border-radius: 14px;
    background: #fff;
    color: #6b7683;
    font-size: 13px;
    font-family: inherit;
    line-height: 20px;
    cursor: pointer;
    outline: none;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.txdh-novel-cats button:hover {
    border-color: #20c4ab;
    color: #20c4ab;
}

.txdh-novel-cats button.active {
    border-color: #20c4ab;
    background: #20c4ab;
    color: #fff;
    font-weight: 600;
}

/* ------------------------------ 列表 ------------------------------ */
.txdh-novel-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.txdh-novel-item {
    min-width: 0;
    list-style: none;
}

.txdh-novel-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.txdh-novel-pic {
    display: block;
    position: relative;
    overflow: hidden;
    padding-bottom: 133.33%;
    background: #f2f4f7;
    box-shadow: 0 2px 6px rgba(17, 24, 39, .08);
}

.txdh-novel-pic img {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    transition: transform .45s ease;
}

.txdh-novel-pic img.is-error {
    object-fit: contain;
    padding: 14% 8%;
    background: #f4f6f8;
}

.txdh-novel-no {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    min-width: 22px;
    padding: 0 6px;
    border-radius: 0 0 8px 0;
    background: rgba(32, 196, 171, .92);
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.txdh-novel-rank {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 10px 8px 5px;
    background: linear-gradient(180deg, rgba(10, 18, 26, 0), rgba(10, 18, 26, .62));
    color: #fff;
    font-size: 12px;
    font-style: normal;
    line-height: 16px;
    text-align: right;
}

.txdh-novel-name {
    display: block;
    overflow: hidden;
    margin: 8px 0 0;
    height: 18px;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: color .2s ease;
}

.txdh-novel-meta {
    display: flex;
    align-items: center;
    margin: 4px 0 0;
    color: #a3abb5;
    font-size: 12px;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
}

.txdh-novel-meta i {
    margin: 0 4px;
    font-style: normal;
}

.txdh-novel-item:hover .txdh-novel-pic img {
    transform: scale(1.06);
}

.txdh-novel-item:hover .txdh-novel-name {
    color: #20c4ab;
}

/* ------------------------------ 骨架屏 / 状态 ------------------------------ */
.txdh-novel-item.is-skeleton .txdh-novel-pic,
.txdh-novel-item.is-skeleton .txdh-novel-skel {
    background: linear-gradient(90deg, #f1f3f6 25%, #e7ebef 37%, #f1f3f6 63%);
    background-size: 400% 100%;
    animation: txdhNovelShimmer 1.4s ease infinite;
}

.txdh-novel-skel {
    display: block;
    height: 12px;
    margin-top: 9px;
    border-radius: 4px;
}

.txdh-novel-skel-title {
    width: 78%;
}

.txdh-novel-skel-meta {
    width: 52%;
    height: 10px;
    margin-top: 7px;
}

@keyframes txdhNovelShimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

.txdh-novel-empty {
    grid-column: 1 / -1;
    padding: 42px 0;
    color: #99a2ad;
    font-size: 13px;
    text-align: center;
    list-style: none;
}

.txdh-novel-retry {
    margin-left: 10px;
    padding: 3px 14px;
    border: 1px solid #20c4ab;
    border-radius: 14px;
    background: none;
    color: #20c4ab;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.txdh-novel-retry:hover {
    background: #20c4ab;
    color: #fff;
}

/* ------------------------------ 底部翻页 ------------------------------ */
.txdh-novel-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: #b0b8c1;
    font-size: 12px;
    line-height: 18px;
}

.txdh-novel-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.txdh-novel-pager[hidden] {
    display: none;
}

.txdh-novel-page-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid #e2e7ec;
    border-radius: 6px;
    background: #fff;
    color: #6b7683;
    font-size: 13px;
    font-family: inherit;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    outline: none;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.txdh-novel-page-btn:hover:not([disabled]):not(.active) {
    border-color: #20c4ab;
    color: #20c4ab;
}

.txdh-novel-page-btn.active {
    background: #20c4ab;
    border-color: #20c4ab;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.txdh-novel-page-btn[disabled] {
    color: #c2c8d0;
    cursor: default;
}

.txdh-novel-page-gap {
    min-width: 18px;
    color: #b8bfc7;
    font-size: 13px;
    line-height: 30px;
    text-align: center;
    cursor: default;
}

/* ------------------------------ 响应式 ------------------------------ */
@media screen and (max-width: 1200px) {
    .txdh-novel-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media screen and (max-width: 900px) {
    .txdh-novel-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media screen and (max-width: 620px) {
    .index-web-section.txdh-novel-section {
        padding-left: 12px;
        padding-right: 12px;
    }

    .txdh-novel-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
    }
}

/* 移动端不展示该区块（PHP 端已不输出结构，此处按主题移动端类名兜底） */
body.mobile-page .txdh-novel-section {
    display: none !important;
}

/* ------------------------------ 夜间模式 ------------------------------ */
html.txdh-dark-mode .txdh-novel-section,
html.txdh-dark-mode .indexSearch + .article .txdh-novel-section {
    background: #171f27 !important;
    border-color: #283541 !important;
}

html.txdh-dark-mode .txdh-novel-section .txdh-novel-title h3,
html.txdh-dark-mode .txdh-novel-name {
    color: #e6edf5;
}

html.txdh-dark-mode .txdh-novel-period {
    background: #1b242c;
}

html.txdh-dark-mode .txdh-novel-period button {
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-novel-period button:hover {
    color: #66dccb;
}

html.txdh-dark-mode .txdh-novel-period button.active {
    background: #66dccb;
    color: #0f1b1a;
}

html.txdh-dark-mode .txdh-novel-cats button {
    border-color: #2b3642;
    background: #1b242c;
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-novel-cats button:hover {
    border-color: #66dccb;
    color: #66dccb;
}

html.txdh-dark-mode .txdh-novel-cats button.active {
    border-color: #66dccb;
    background: #66dccb;
    color: #0f1b1a;
}

html.txdh-dark-mode .txdh-novel-pic,
html.txdh-dark-mode .txdh-novel-item.is-skeleton .txdh-novel-pic,
html.txdh-dark-mode .txdh-novel-item.is-skeleton .txdh-novel-skel {
    background: linear-gradient(90deg, #1c242c 25%, #232d37 37%, #1c242c 63%);
    background-size: 400% 100%;
    box-shadow: none;
}

html.txdh-dark-mode .txdh-novel-pic img.is-error {
    background: #1b242c;
}

html.txdh-dark-mode .txdh-novel-meta,
html.txdh-dark-mode .txdh-novel-foot,
html.txdh-dark-mode .txdh-novel-empty {
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-novel-item:hover .txdh-novel-name {
    color: #66dccb;
}

html.txdh-dark-mode .txdh-novel-page-btn {
    border-color: #2b3642;
    background: #1b242c;
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-novel-page-btn:hover:not([disabled]):not(.active) {
    border-color: #66dccb;
    color: #66dccb;
}

html.txdh-dark-mode .txdh-novel-page-btn.active {
    border-color: #66dccb;
    background: #66dccb;
    color: #0f1b1a;
}

html.txdh-dark-mode .txdh-novel-page-btn[disabled],
html.txdh-dark-mode .txdh-novel-page-gap {
    color: #5d6874;
}
