/* ==========================================================================
   蝶梦 · 视觉打磨层（hig-polish）
   --------------------------------------------------------------------------
   依据 Apple HIG 的审查结论做的统一收口，只在各页面样式之后加载（后写覆盖前写）：
   1. 字号有下限（≥11px）、层级靠字重与字号而不是堆颜色
   2. 次级文字对比度达标（白底 ≥4.5:1）
   3. 一张图上只用一种强调色：装饰性图标统一为主色，状态色各司其职
   4. 圆角/阴影/标签/焦点环全站一套
   5. 悬停、按下、焦点、减弱动效四种状态都有明确表现
   只改视觉，不动任何 DOM 结构、路由与交互逻辑。
   ========================================================================== */

/* ---------------------------------------------------------------- 1. 令牌 */
:root {
    /* 文字：原 #848492 在白底约 3.5:1，正文小字不达标，整体压深一档 */
    --bh-text-sub: #5b5e67;
    --bh-text-muted: #6f7280;
    --bh-text-placeholder: #9c9faa;

    /* 线条更轻，避免整页被灰线切碎 */
    --bh-border: #e7e8ec;
    --bh-border-light: #f1f2f5;

    /* 卡片圆角与阴影：一层描边 + 一层柔和投影，不用重阴影 */
    --bh-radius-card: 10px;
    --bh-shadow-sm: 0 1px 2px rgba(17, 18, 21, .04), 0 2px 8px rgba(17, 18, 21, .04);
    --bh-shadow: 0 2px 6px rgba(17, 18, 21, .05), 0 10px 24px rgba(17, 18, 21, .07);
    --bh-shadow-lg: 0 8px 20px rgba(17, 18, 21, .08), 0 22px 44px rgba(17, 18, 21, .12);

    /* 统一的焦点环与缓动 */
    --bh-focus-ring: 0 0 0 3px rgba(255, 84, 83, .28);
    --bh-ease: cubic-bezier(.2, .7, .3, 1);
    --bh-transition: color .18s var(--bh-ease), background-color .18s var(--bh-ease),
        border-color .18s var(--bh-ease), box-shadow .18s var(--bh-ease), transform .18s var(--bh-ease);

    /* 字号下限：9/10px 的角标统一抬到 11px */
    --bh-fs-2xs: 11px;
}

/* ---------------------------------------------------------------- 2. 基础 */
.bh-page {
    font-size: var(--bh-fs-base);
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

.bh-page h1,
.bh-page h2,
.bh-page h3 {
    letter-spacing: -.011em;
}

.bh-page ::selection {
    background: rgba(255, 84, 83, .16);
}

/* 键盘焦点：全站统一 2px 主色环，鼠标点击不出现 */
.bh-page a:focus-visible,
.bh-page button:focus-visible,
.bh-page input:focus-visible,
.bh-page select:focus-visible,
.bh-page textarea:focus-visible,
.bh-page summary:focus-visible {
    outline: 2px solid var(--bh-primary);
    outline-offset: 2px;
    border-radius: var(--bh-radius-xs);
}

.bh-page a,
.bh-page button {
    -webkit-tap-highlight-color: transparent;
}

/* 减少动态效果：保留状态变化，去掉位移与缩放 */
@media (prefers-reduced-motion: reduce) {
    .bh-page *,
    .bh-page *::before,
    .bh-page *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    .bh-card:hover .bh-card__cover img,
    .bh-quick:hover .bh-quick__icon,
    .bh-btn:active {
        transform: none !important;
    }
}

/* ---------------------------------------------------------------- 3. 标题 */
/* 分区标题：18 → 20px，700 → 600，靠字号建立层级而不是靠粗体 */
.bh-block__title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.012em;
}

/* 分区前的装饰方块原来分红/蓝/金/绿四色，去掉彩虹，统一主色 */
.bh-block__icon,
.bh-block__icon--blue,
.bh-block__icon--gold,
.bh-block__icon--green {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--bh-primary);
    color: #fff;
    font-size: 11px;
}

.bh-block__more,
.bh-block__actions a {
    font-size: var(--bh-fs-xs);
}

/* ---------------------------------------------------------------- 4. 卡片 */
.bh-card__cover {
    border-radius: var(--bh-radius-card);
    box-shadow: inset 0 0 0 1px rgba(17, 18, 21, .04);
    transition: box-shadow .22s var(--bh-ease), transform .22s var(--bh-ease);
}

.bh-card:hover .bh-card__cover {
    box-shadow: inset 0 0 0 1px rgba(17, 18, 21, .06), var(--bh-shadow);
    transform: translateY(-2px);
}

.bh-card__title {
    margin: 10px 0 5px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -.005em;
}

.bh-card__meta {
    font-size: 12px;
    color: var(--bh-text-muted);
}

/* 角标：10px → 11px，圆角与标签体系对齐 */
.bh-card__flag {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: var(--bh-fs-2xs);
    line-height: 1.6;
    letter-spacing: .2px;
}

.bh-card__status {
    font-size: var(--bh-fs-2xs);
    padding: 3px 8px;
}

/* ---------------------------------------------------------------- 5. 分类条 */
.bh-cat {
    font-size: 14px;
}

.bh-cat__num {
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11.5px;
    color: var(--bh-text-muted);
    font-variant-numeric: tabular-nums;
}

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

/* 顶部快捷入口：图标圆角与卡片统一，悬停给一圈柔光 */
.bh-quick__icon {
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(17, 18, 21, .04);
    transition: transform .2s var(--bh-ease), box-shadow .2s var(--bh-ease);
}

.bh-quick:hover .bh-quick__icon {
    box-shadow: var(--bh-shadow-sm);
}

/* ---------------------------------------------------------------- 6. 标签/按钮 */
.bh-tag {
    height: 23px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .1px;
}

/* 按钮只调字重与反馈，不改尺寸，避免各页面布局抖动 */
.bh-page .bh-btn {
    font-weight: 500;
    letter-spacing: .1px;
}

.bh-page .bh-btn:active {
    transform: translateY(1px);
}

.bh-page .bh-btn:disabled,
.bh-page .bh-btn.is-disabled,
.bh-page .bh-btn[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
}

.bh-page .bh-btn--primary {
    box-shadow: 0 2px 8px rgba(255, 84, 83, .18);
}

/* 输入框：统一内阴影描边 + 焦点环 */
.bh-page input[type="text"],
.bh-page input[type="search"],
.bh-page input[type="email"],
.bh-page input[type="password"],
.bh-page textarea,
.bh-page select {
    border-radius: var(--bh-radius-sm);
    transition: border-color .18s var(--bh-ease), box-shadow .18s var(--bh-ease);
}

.bh-page input:focus,
.bh-page textarea:focus,
.bh-page select:focus {
    outline: none;
    border-color: var(--bh-primary);
    box-shadow: var(--bh-focus-ring);
}

/* ---------------------------------------------------------------- 7. 小说页 */
.bh-nv-panel {
    border-radius: var(--bh-radius-card);
    border-color: var(--bh-border-light);
    box-shadow: var(--bh-shadow-sm);
}

.bh-nv-panel__title {
    font-weight: 600;
    letter-spacing: -.008em;
}

/* 试读段落原来一行一段、段间距过大，收成正常阅读节奏 */
.bh-nv-panel p {
    margin: 0 0 10px;
    line-height: 1.88;
}

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

/* 目录行：统一行高与悬停底色，编号用等宽数字 */
.bh-nv-dir a,
.bh-nv-toc a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    transition: background-color .16s var(--bh-ease), color .16s var(--bh-ease);
}

.bh-nv-dir a:hover,
.bh-nv-toc a:hover {
    background: var(--bh-primary-light);
}

/* 同类推荐卡：标题两行、封面统一 16:9 */
.bh-nv-card__cover,
.bh-nv-grid .bh-card__cover {
    border-radius: var(--bh-radius-card);
}

/* ---------------------------------------------------------------- 8. 作品页 */
/* 左栏四项数据的小标签原来 10.5px，低于可读下限 */
.bh-play .bh-nums__label {
    font-size: 11.5px;
    letter-spacing: .1px;
    color: var(--p-txt-2, #a9adb8);
}

.bh-play .bh-info__state {
    font-size: 11.5px;
    height: 20px;
    line-height: 20px;
}

/* 评论区日期与昵称拉开层级，日期不再跟正文抢注意力 */
.bh-play .comment-date {
    font-size: 11.5px;
    color: var(--p-txt-3, #8b8f9a);
}

.bh-play .comment-list .user-name {
    font-weight: 600;
}

/* 评论输入框与发送按钮同高 */
.bh-play .comment-form textarea,
.bh-play .comment-form input[type="text"] {
    border-radius: 8px;
}

/* ---------------------------------------------------------------- 9. 后台 */
.bh-adm__table th {
    color: var(--bh-text-sub);
    letter-spacing: .2px;
}

.bh-adm__table tbody tr:hover td {
    background: #fafbfe;
}

.bh-adm__tab,
.bh-adm__op,
.bh-adm__sort {
    transition: var(--bh-transition);
}

.bh-adm .bh-btn:active {
    transform: translateY(1px);
}

/* ---------------------------------------------------------------- 10. 响应式 */
@media (max-width: 640px) {
    .bh-container {
        max-width: calc(100% - 32px);
    }

    .bh-block__title {
        font-size: 18px;
    }

    .bh-card__title {
        font-size: 13.5px;
    }

    .bh-card__meta {
        font-size: 11.5px;
    }

    /* 手机端触控目标不小于 40px */
    .bh-page .bh-btn {
        min-height: 40px;
    }

    .bh-quick__icon {
        width: 44px;
        height: 44px;
    }
}

/* ---------------------------------------------------------------- 11. 补漏 */
/* 榜单卡的分值单位与角标同为 10px，抬到 11px */
.bh-rcard__score em,
.bh-rcard__score span,
.bh-rcard__flag {
    font-size: var(--bh-fs-2xs);
    line-height: 1.6;
}

.bh-rcard__flag {
    padding: 2px 6px;
    border-radius: 4px;
}

/* 作品页评论里的「作者」小徽标 */
body.bh-play .comment-author-badge {
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------- 12. 试读 */
/* 详情页试读只是节选，行距与段距收一档；阅读页（--reader）保持舒展不动 */
.bh-nv-panel .bh-nv-prose p {
    margin: 0 0 .55em;
    line-height: 1.85;
}

.bh-nv-panel .bh-nv-prose p:last-child {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- 13. 榜单卡 */
.bh-rcard {
    border-radius: var(--bh-radius-card);
    border-color: #e8e9ee;
    transition: border-color .18s var(--bh-ease), box-shadow .18s var(--bh-ease), transform .18s var(--bh-ease);
}

.bh-rcard__cover {
    border-radius: 8px;
}

.bh-rcard:hover {
    border-color: #f0c9c8;
    box-shadow: var(--bh-shadow);
    transform: translateY(-2px);
}

.bh-rcard__name {
    letter-spacing: -.006em;
}

/* ---------------------------------------------------------------- 14. 作者专区 */
/* 原来是黄/粉/蓝/绿四块高饱和渐变，换成同明度的浅色卡 + 一枚状态点，
   保留四块之间的区分，但不再抢主色 */
.bh-author {
    height: 88px;
    padding: 18px 20px;
    border-radius: var(--bh-radius-card);
    border: 1px solid var(--bh-border-light);
    --bh-author-dot: #f0a020;
    transition: border-color .18s var(--bh-ease), box-shadow .18s var(--bh-ease), transform .18s var(--bh-ease);
}

.bh-author--yellow { background: #fffaf0; --bh-author-dot: #e8a020; }
.bh-author--pink   { background: #fff5f6; --bh-author-dot: #ef7f8e; }
.bh-author--blue   { background: #f3f8ff; --bh-author-dot: #4a89dc; }
.bh-author--green  { background: #f2faf5; --bh-author-dot: #35a86b; }

.bh-author:hover {
    transform: translateY(-2px);
    border-color: var(--bh-border);
    box-shadow: var(--bh-shadow-sm);
}

.bh-author__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--bh-text);
}

.bh-author__title::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bh-author-dot);
}

.bh-author__deco {
    background: rgba(17, 18, 21, .035);
}

.bh-author__deco::after {
    background: rgba(17, 18, 21, .045);
}

/* ---------------------------------------------------------------- 15. 页脚 */
.bh-footer__links,
.bh-footer__links--nav a,
.bh-footer__copy,
.bh-qr__label {
    font-size: 12.5px;
    color: var(--bh-text-muted);
}

.bh-footer__links a {
    color: var(--bh-text-sub);
}

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

/* ---------------------------------------------------------------- 16. 阅读页 */
/* 正文行距 2.15 → 1.95、段距 1em → .65em：仍然舒展，但一屏能多读两段，
   长文阅读不容易「一段一屏」 */
.bh-nv-prose--reader p {
    margin: 0 0 .65em;
    line-height: 1.95;
}

.bh-nv-prose--reader p:last-child {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- 17. 页脚置底 */
/* 规则：任何页面只要内容不足一屏，footer 必须贴在视口底部。
   body.bh-page 是 flex column，给 footer 一个 margin-top:auto 即可推到底；
   内容超过一屏时 auto 归零，footer 正常跟在内容后面，不会遮挡。 */
body.bh-page > footer {
    margin-top: auto;
    flex: none;
}
