/* ============================================
   iamlw 主题全局样式
   色值统一由 tokens.css 定义，本文件只引用变量
   ============================================ */

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------- 全站布局栅格 ----------
   导航、主体、页脚共用同一组变量：容器最大宽度 + 左右安全留白。
   三处都按 width:100% / max-width / margin:auto / padding-inline 书写，
   宽屏时内容左右边缘严格对齐；窄屏只改 gutter，不用逐处改数值。 */
:root {
    --layout-max: 1280px;
    --layout-gutter: 24px;
}

@media (max-width: 768px) {
    :root {
        --layout-gutter: 16px;
    }
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'HarmonyOS_Sans_SC', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background-color: var(--bg);
    /* Sticky footer：内容不足一屏时让页脚落到视口最底部。
       只把 body 变成纵向 flex 容器，配合 #footer 的 margin-top:auto 吸收剩余空间；
       不给 main 设 flex-grow，首页五屏等长页面保持原样、不会被拉伸。 */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 页面底色：全站默认背景图 assets/images/index.webp
   固定铺满视口，滚动时不动；上层再盖一层由 tokens.css 定义的蒙版，
   保证浅色/深色两种模式下的正文都可读（浓度只需改 --site-bg-scrim）。 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -999;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--site-bg-scrim), var(--site-bg-scrim)),
        url('../images/index.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* ============================================
   侧边滚动条：形态与配色
   Chromium / Safari 用 ::-webkit-scrollbar 精确控制 8px 宽 + 4px 圆角；
   Firefox 用标准属性着色。两者刻意隔离：Chrome 121+ 一旦声明 scrollbar-color
   就会忽略 webkit 伪元素，宽度与圆角会失效。
   ============================================ */
@supports (-moz-appearance: none) {
    html {
        scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
        scrollbar-width: thin;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-thumb:active {
    background: var(--scrollbar-thumb-active);
}

::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

/* 窄屏收窄，呼应参照站的 6px 设定 */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease;
}

a:hover {
    color: var(--accent-hover);
    /* 悬停只变色，不出现下划线；同时压住插件与浏览器默认样式 */
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

ul, ol {
    list-style: none;
}

/* ---------- 容器：文章页 / 独立页 / 404 ----------
   底部内边距对齐 .stream-page 的 30px，且仅长页面（超出一屏）生效；
   首页 .home-page 不使用 .container，不受影响。 */
.container {
    max-width: var(--layout-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--layout-gutter) 0;
}

#body.is-long .container {
    padding-bottom: 30px;
}

/* ============================================
   顶部导航栏
   ============================================ */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    --nav-h: 68px;
    height: var(--nav-h);
    background-color: transparent;
    transition: background-color .3s ease, box-shadow .3s ease;
}

/* 滚动后导航栏加背景；非首页默认常驻同款背景（.nav-solid 由 header.php 按页面类型输出）。
   注意：backdrop-filter 不能挂在 .site-nav 自身——祖先一旦带滤镜，内部 fixed 抽屉的
   包含块会被收束到这个 56px 高的导航条上，导致抽屉高度塌缩、错位残留。
   模糊改由 ::before 伪元素承担，伪元素不是抽屉的祖先元素，不影响其 fixed 定位。 */
.site-header.header-scrolled .site-nav,
.site-header.nav-solid .site-nav {
    background-color: var(--nav-scrolled);
    box-shadow: var(--nav-shadow);
}

.site-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 0;
    pointer-events: none;
}

/* 导航栏最顶部阅读进度条：未滚动时宽度为 0，下滑后按阅读百分比填充 */
.nav-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 2;
    pointer-events: none;
    background: transparent;
}

.nav-topbar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--brand-deep) 0%, var(--brand-blue) 100%);
    transition: width .1s linear;
}

.nav-inner {
    position: relative;
    z-index: 1;
    max-width: var(--layout-max);
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--layout-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 左侧 Logo 区 */
.nav-left {
    flex: 0 0 auto;
}

.nav-logo a {
    display: flex;
    align-items: center;
    height: 60px;
}

.nav-logo img {
    height: 45px;
    width: auto;
}

/* 模式1：纯 LOGO 图片 */
.logo-img {
    position: relative;
}

.logo-img .logo-dark {
    display: none;
}

html[data-theme="dark"] .logo-img .logo-light {
    display: none;
}

html[data-theme="dark"] .logo-img .logo-dark {
    display: block;
}

/* 模式2：图标 + 站点名称 */
.logo-icon-text {
    gap: 10px;
}

.logo-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.logo-icon img {
    height: 30px;
    width: 30px;
    border-radius: 6px;
}

.logo-icon .icon-dark {
    display: none;
}

html[data-theme="dark"] .logo-icon .icon-light {
    display: none;
}

html[data-theme="dark"] .logo-icon .icon-dark {
    display: block;
}

.logo-text {
    font-size: 26px;
    font-weight: 700;
    color: var(--nav-link);   /* 头部站名：与导航文字/图标同一深色 */
    transition: color .3s ease;
}

/* ============================================
   顶部菜单：形态 1:1 复刻 itlaoli.com（hopelee .nav-pills）
   照搬 15px 字号、主项底部 2px 指示线由中间向两侧 .6s 展开、
   hover / 当前项文字变蓝、有子项主项的 CSS 小三角。
   间距在参考站 0 15px 0 5px（相邻 20px）基础上按站点偏好整体放宽：
   大屏约 40px，随视口收窄自动回落到接近参考站的值，避免 7 个带图标的
   菜单项把三段式顶栏挤出视口；768px 以下再单独收紧。
   配色全部引用 tokens.css 的本站语义变量，沿用当前色板；
   末态高亮（指示线展开 + 蓝字）放在文件末尾的高特异性段，
   以压过 index.css 首页白字与深色模式覆写，不使用 !important。
   ============================================ */
.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0;                 /* 间距交给每个 li 的 margin，与参考站一致 */
    font-size: 14px;
}

.nav-menu > li {
    position: relative;
    list-style: none;
    /* 相邻两项的实际间距 = 右 margin + 左 margin。
       用「视口线性插值 + 上下限」而不是固定值：菜单 7 项、white-space:nowrap，
       .nav-inner 又限宽 1200px，中等宽度下固定大间距会把 logo / 右侧工具挤出顶栏。
       1440px+ → 26+14 = 40px（参考站 20px 的两倍，肉眼明显拉开）
       1024px  → 约 32px，900px → 约 26px
       769px   → 约 20px，平滑回落到参考站原值，不产生断点跳变
       768px 以下交给后面的窄屏规则进一步收紧。 */
    margin: 0 clamp(10px, calc(3.4vw - 12px), 26px)
            0 clamp(2px, calc(1.25vw - 4px), 14px);
}

.nav-menu > li > a {
    display: flex;
    align-items: center;
    height: var(--nav-h);
    font-size: 16px;
    font-weight: 400;
    white-space: nowrap;
    color: var(--nav-link);
    transition: color .25s ease;
}

/* 菜单项线性图标：描边跟随文字色，hover 时与文字一起变蓝 */
.nav-item-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 参考站 .nav-pills li:before：2px 指示线默认收在中间（width:0）。
   展开下拉时会与面板顶线合并成同一条线（规则见文件末尾），height / bottom
   不参与过渡，避免合并瞬间线条上下抖动；width / left 仍保留 .6s 展开动画。 */
.nav-menu > li::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--brand-deep);
    transition: width .6s, left .6s, background-color .25s;
}

/* 有子项的主项：参考站 .menu-item-has-children > a:after 的 CSS 小三角 */
.nav-menu .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-top: 4px solid currentColor;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    position: relative;
    left: 5px;
    overflow: hidden;
}

/* 右侧功能图标 */
/* 汉堡按钮仅窄屏（移动终端）显示，桌面端隐藏；
   与 .nav-icon 同元素，需提特异性压过 .nav-icon 的 display:flex */
.nav-icon.menu-toggle {
    display: none;
}

.menu-toggle .icon-close {
    display: none;
}

.menu-toggle.open .icon-burger {
    display: none;
}

.menu-toggle.open .icon-close {
    display: block;
}

.nav-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--nav-link);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color .2s ease, color .2s ease;
}

.nav-icon:hover {
    background-color: var(--hover-wash);
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

/* 主题切换图标：浅色显示太阳，深色显示月亮 */
.nav-icon .icon-moon {
    display: none;
}

.nav-icon .icon-sun {
    display: block;
}

html[data-theme="dark"] .nav-icon .icon-sun {
    display: none;
}

html[data-theme="dark"] .nav-icon .icon-moon {
    display: block;
}

/* ============================================
   头部分类下拉菜单：
   按站点偏好做了三处调整：
   1) 面板以「分类」主项（含图标）为中心水平居中，而非参考站的左对齐；
      顶部箭头仍在面板 50% 处，因此箭头与主项自动同轴。
   2) 取消参考站子项 hover 时左侧浮现的 10px 短横线。
   3) 子项补一枚线性图标，与顶部菜单的图标语言一致。
   保留：8px 10px 内距、4px 品牌顶线、圆角 4px、96% 玻璃底、
   顶部上箭头、子项 float:left 横排 + rotateY(90deg) 翻入（无逐项递进）。
   展开方式：桌面 :hover + 触屏 .open + 键盘 :focus-within。
   配色一律引用 tokens.css 的本站语义变量，沿用当前色板。
   ============================================ */

/* 悬停热区桥：主项与面板之间不留空隙，鼠标斜向移动不会丢 hover。
   面板改为相对主项居中后左右都会超出，桥改为左右对称各 24px；
   仍保持窄范围，避免在相邻菜单项下方形成过大的误触区。 */
.nav-menu .nav-dropdown::after {
    content: '';
    position: absolute;
    left: -24px;
    right: -24px;
    bottom: -4px;
    height: 4px;
    z-index: 1;
}

/* 面板默认态（参考站 .nav-pills li > ul） */
.nav-menu .nav-dropdown > .dropdown-menu.children {
    position: absolute;
    /* 上移 2px：顶线与主项高亮线同位；展开态横线规则见文件末尾 */
    top: calc(100% - 2px);
    /* 面板中心对准「分类」主项中心：li 宽度本身已包含图标、文字与小三角，
       无需额外补偿；顶部箭头同在面板 50% 处，两者自动同轴。 */
    left: 50%;
    transform: translateX(-50%);
    list-style: none;
    margin: 0;
    padding: 8px 10px;
    max-width: calc(100vw - 32px);
    border-top: 4px solid var(--nav-dropdown-accent);
    border-radius: 4px;
    background-color: var(--nav-dropdown-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: var(--nav-dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease-in-out, visibility 0s linear .25s;
    z-index: 1100;
}

/* 面板顶部中央的上箭头（参考站 .nav-pills li .sub-menu:before） */
.nav-menu .nav-dropdown > .dropdown-menu.children::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--nav-dropdown-accent);
}

/* 展开：键盘聚焦 / 触屏点击（.open 由 main.js 维护） */
.nav-menu .nav-dropdown:focus-within > .dropdown-menu.children,
.nav-menu .nav-dropdown.open > .dropdown-menu.children {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .25s ease-in-out, visibility 0s;
}

/* 桌面悬停单独隔离，避免触屏把 :hover 粘住 */
@media (hover: hover) {
    .nav-menu .nav-dropdown:hover > .dropdown-menu.children {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity .25s ease-in-out, visibility 0s;
    }
}

/* 子项默认态：参考站 .nav-pills li>ul>li —— 横排 + 90° 翻折隐藏。
   6 个 class 前缀把特异性提到 (0,6,2)，稳定压过深色模式的
   html[data-theme="dark"] … .nav-menu li a (0,5,4) 等后代覆写。 */
.site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li {
    position: relative;
    display: block;
    float: left;
    color: var(--nav-dropdown-text);
    padding: 0 15px;
    transform: rotateY(90deg);
    transform-origin: 50% 50%;
}

/* 展开态：子项归正（参考站 hover 时 transform:none，无过渡、无递进） */
.site-nav .nav-inner .nav-menu .nav-dropdown:focus-within > .dropdown-menu.children > li,
.site-nav .nav-inner .nav-menu .nav-dropdown.open > .dropdown-menu.children > li {
    transform: none;
}
@media (hover: hover) {
    .site-nav .nav-inner .nav-menu .nav-dropdown:hover > .dropdown-menu.children > li {
        transform: none;
    }
}

/* 子项链接：14px、不换行、上下 4px 内距；flex 让图标与文字同轴对齐 */
.site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 16px;
    line-height: inherit;
    white-space: nowrap;
    color: inherit;
    transition: all .3s ease;
}

/* 下拉分类图标：与顶部菜单同一套线性风格，尺寸随 14px 字号收小。
   stroke 用 currentColor，hover 字色变化时图标同步变色。 */
.cat-item-icon {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 子项 hover 字色：深色模式同样用高特异性前缀，避免被全局 a:hover 压掉 */
.site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:hover,
.site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:focus-visible {
    color: var(--nav-dropdown-text-hover);
}
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a {
    color: var(--nav-dropdown-text);
}
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:hover {
    color: var(--nav-dropdown-text-hover);
}

/* 深色 · 已滚动 / 内页常驻：下拉子项跟随主菜单次级灰 muted（悬停 / 聚焦时除外，回落 hover 蓝） */
html[data-theme="dark"] body .site-header.header-scrolled .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:not(:hover):not(:focus-visible),
html[data-theme="dark"] body .site-header.nav-solid .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:not(:hover):not(:focus-visible) {
    color: var(--muted);
}

/* 深色 · 已滚动 / 内页常驻下的悬停兜底：与浅色一致用品牌蓝 hover 色，
   否则上面带 .header-scrolled/.nav-solid 的静态 muted 规则特异性更高，会压住 hover 字色 */
html[data-theme="dark"] body .site-header.header-scrolled .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:hover,
html[data-theme="dark"] body .site-header.nav-solid .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li > a:hover {
    color: var(--nav-dropdown-text-hover);
}

/* 二级分类：用轻微缩进表达层级，不加额外装饰 */
.site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li.is-child > a {
    padding-left: 8px;
}

/* ============================================
   Hero 区域
   ============================================ */
.hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* 背景图统一由全站 body::before 提供；原 default.webp 路径并不存在，已移除 */
    background: transparent;
    padding: 80px 20px 60px;
}

/* 深色遮罩，保证白色标题在全站背景图上依然可读 */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--hero-scrim);
}

.hero-inner {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--on-dark);
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(var(--night-rgb), 0.24);
}

.hero-desc {
    font-size: 18px;
    color: var(--on-dark-2);
    text-shadow: 0 1px 5px rgba(var(--night-rgb), 0.24);
}

/* ============================================
   主体内容
   ============================================ */
#body {
    margin-top: 0;
    position: relative;
    z-index: 2;
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 768px) {
    .site-nav {
        --nav-h: 56px;
        height: var(--nav-h);
    }

    .nav-inner {
        padding: 0 var(--layout-gutter);
        justify-content: space-between;
    }

    /* 窄屏三栏：左汉堡、中 logo（按后端设置显示）、右搜索 */
    .nav-icon.menu-toggle {
        display: flex;
    }

    .nav-left {
        flex: 1;
        display: flex;
        justify-content: center;
    }

    /* 窄屏隐藏深色切换，右侧仅保留搜索图标 */
    .nav-right .theme-toggle {
        display: none;
    }

    .nav-logo img {
        height: 30px;
    }

    .logo-text {
        font-size: 18px;
    }

    /* 窄屏菜单改左侧抽屉：默认收起，.open 滑入 */
    .nav-menu {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        bottom: 0;
        width: min(78vw, 300px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 16px 0;
        overflow-y: auto;
        overflow-x: hidden;
        background: var(--nav-scrolled);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--nav-shadow);
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.65, .05, .36, 1);
        z-index: 999;
    }

    .nav-menu.open {
        transform: translateX(0);
    }

    .nav-menu > li {
        margin: 0;
    }

    /* 抽屉内当前项只高亮文字与图标，不展开底部指示横线 */
    .nav-menu > li::before {
        display: none;
    }

    .nav-menu > li > a {
        display: flex;
        align-items: center;
        padding: 14px 24px;
        font-size: 15px;
    }

    .nav-item-icon {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }

    /* 抽屉内分类下拉：内嵌纵向展开，替代桌面浮层 */
    .nav-menu .nav-dropdown > .dropdown-menu.children {
        position: static;
        left: auto;
        transform: none;
        max-width: none;
        margin: 0;
        padding: 0 0 8px;
        border-top: none;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: none;
        background: transparent;
    }

    .nav-menu .nav-dropdown.open > .dropdown-menu.children {
        display: block;
    }

    .nav-menu .nav-dropdown > .dropdown-menu.children::before {
        display: none;
    }

    .site-nav .nav-inner .nav-menu .nav-dropdown > .dropdown-menu.children > li {
        float: none;
        transform: none;
        padding: 0 10px 0 30px;
    }

    /* 页脚：两栏收成纵向堆叠，友链单列 */
    #footer {
        padding: 26px 0 20px;
    }
    .footer-main {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }
    .footer-left {
        flex: 1 1 auto;
        width: 100%;
    }
    .footer-friends ul {
        grid-template-columns: 1fr;
    }
    .footer-copy {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
    }

    .hero {
        min-height: 50vh;
        padding: 70px 16px 50px;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-desc {
        font-size: 16px;
    }
}

/* ============================================
   深色模式：中性深灰底 + 提亮的品牌蓝，由 tokens.css 覆写变量
   ============================================ */

/* View Transitions：禁用默认淡入淡出，配合圆形扩散/收拢动画
   --vt-clip-* 是「首帧裁剪」，由 main.js 在 startViewTransition 之前一次性设好：
   动画要等 transition.ready 才启动，没有它就会先绘制一帧未裁剪的整屏快照（闪屏）。
   过渡期间绝不能再改这两个变量 —— 伪元素的 computed style 在过渡中是冻结的，
   改了不生效；动画终值改由 main.js 的 WAAPI fill:forwards 保持，避免结束回落到
   circle(0) 把视图裁掉（那会让扩散特效看起来消失）。 */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: var(--vt-old-z, 1);
    clip-path: var(--vt-clip-old, none);
}

::view-transition-new(root) {
    z-index: var(--vt-new-z, 2);
    clip-path: var(--vt-clip-new, none);
}

/* 切换期间关闭所有 CSS 颜色过渡：
   View Transition 会在 DOM 更新后立刻拍新快照，若颜色仍处于 .4s 过渡中，
   快照拍到的是中间色，动画结束瞬间再跳到终值 → 闪屏。
   此处保留 !important（全站仅两处之一）：选择器以通配符收口，特异性为 0，
   必须压过全站所有 transition 声明，包括后加载的 index.css 与插件样式。 */
html.vt-switching,
html.vt-switching body,
html.vt-switching body *,
html.vt-switching body *::before,
html.vt-switching body *::after {
    transition: none !important;
}

/* 深色模式的基础色由 tokens.css 的同名变量自动翻转，body 本身已能生效；
   html[data-theme="dark"] body (0,1,2) 也自然高于 body (0,0,1)，无需 !important */
html[data-theme="dark"] body {
    background-color: var(--bg);
    color: var(--body);
}

/* 全局颜色平滑过渡 */
body, .site-nav, .nav-menu li a, .logo-text, .nav-icon,
.highlight-item, .post-card, .bottom-nav, .screen-heading,
.categories-title, .category-nav-name, .footer-text {
    transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease;
}

html[data-theme="dark"] a:hover {
    color: var(--accent-hover);
}

/* ============================================
   深色模式导航覆写（不用 !important）
   统一前缀 html[data-theme="dark"] body .site-header .site-nav 把特异性
   提到 (0,4,2) 以上，稳定压过 index.css 的首页首屏白字规则：
     .site-header:not(.header-scrolled) .nav-menu li a        (0,3,2)
     .site-header:not(.header-scrolled) .nav-menu li:hover a (0,4,2)
   原先靠 !important 压制，现在靠选择器层级解决。
   ============================================ */

/* 深色 · 未滚动 */
html[data-theme="dark"] body .site-header .site-nav .logo-text {
    color: var(--ink);
}

html[data-theme="dark"] body .site-header .site-nav .nav-menu li a {
    color: var(--ink);
}

/* 深色导航的 hover / active 字色由文件末尾「顶部菜单末态高亮」统一接管 */

html[data-theme="dark"] body .site-header .site-nav .nav-icon {
    color: var(--ink);
}

html[data-theme="dark"] body .site-header .site-nav .nav-icon:hover {
    background-color: var(--hover-wash);
    color: var(--ink);
}

/* 深色 · 已滚动 */
html[data-theme="dark"] body .site-header.header-scrolled .site-nav {
    background-color: var(--nav-scrolled);
    backdrop-filter: blur(10px);
    box-shadow: var(--nav-shadow);
}

html[data-theme="dark"] body .site-header.header-scrolled .site-nav .logo-text,
html[data-theme="dark"] body .site-header.nav-solid .site-nav .logo-text {
    color: var(--ink);
}

html[data-theme="dark"] body .site-header.header-scrolled .site-nav .nav-menu li a,
html[data-theme="dark"] body .site-header.nav-solid .site-nav .nav-menu li a {
    color: var(--muted);
}

/* 深色 · 已滚动的 hover / active 同样交给末尾「顶部菜单末态高亮」规则 */

html[data-theme="dark"] body .site-header.header-scrolled .site-nav .nav-icon,
html[data-theme="dark"] body .site-header.nav-solid .site-nav .nav-icon {
    color: var(--muted);
}

html[data-theme="dark"] body .site-header.header-scrolled .site-nav .nav-icon:hover,
html[data-theme="dark"] body .site-header.nav-solid .site-nav .nav-icon:hover {
    background-color: var(--hover-wash);
    color: var(--ink);
}

/* ============================================
   色彩规范补充：选中态与键盘聚焦
   ============================================ */
::selection {
    background: rgba(var(--brand-cyan-rgb), .28);
    color: var(--ink);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ============================================
   页脚
   深蓝紫半透明玻璃底 + 顶部亮线，上下两栏以细线分隔，
   品牌名做成与导航胶囊同款的渐变胶囊。
   margin-top:auto 是上一轮的 sticky footer，必须保留——
   参照站写死的 64px 上边距会让短页面不再贴底。
   ============================================ */
#footer {
    position: relative;
    /* 横向留白交给 .footer-inner 的栅格变量，保证与导航 / 主体同一条边缘 */
    padding: 32px 0 26px;
    background: var(--footer-bg);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--footer-border);
    color: var(--footer-text);
    font-size: 13px;
    line-height: 1.9;
    /* 剩余空间全部让给页脚上边距：短页面贴底，长页面自动归零、正常跟随内容 */
    margin-top: auto;
    flex-shrink: 0;
}

.footer-inner {
    max-width: var(--layout-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--layout-gutter);
}

.footer-main {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px 40px;
    text-align: left;
}

.footer-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    flex: 2 1 320px;
    min-width: 0;
}

/* 左侧运行天数：纯文字左对齐，无卡片框 */
.footer-tens {
    min-width: 0;
}

.footer-title {
    margin: 0 0 1em;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .5px;
    color: var(--footer-text-muted);
}

.days {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    color: var(--brand-blue);
}

.days .site-runtime-days {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* 随机阅读 */
.footer-rand {
    width: min(50em, 100%);
    min-width: 0;
}

#footer .footer-rand .post {
    display: block;
    margin-top: 6px;
    color: var(--footer-text-strong);
    font-size: 14px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .2s ease;
}

#footer .footer-rand .post:hover {
    color: var(--footer-link-hover);
}

/* 右侧两列友链 */
.footer-friends {
    flex: 1 1 auto;
    min-width: 0;
}

.footer-friends ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 28px;
}

#footer .footer-friends a {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    row-gap: 2px;
    text-decoration: none;
}

#footer .footer-friends .friend-name {
    color: var(--footer-text-strong);
    font-size: 14px;
    font-weight: 600;
    transition: color .2s ease;
}

#footer .footer-friends .friend-desc {
    color: var(--footer-text-muted);
    font-size: 12px;
    line-height: 1.6;
}

#footer .footer-friends a:hover .friend-name {
    color: var(--footer-link-hover);
}

.footer-copy {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--footer-line);
    font-size: 14px;
    color: var(--footer-text);
}

#footer .footer-copy a {
    color: var(--footer-text);
}

#footer .footer-copy a:hover {
    color: var(--footer-link-hover);
}

/* 页脚「站点已运行 N 天」：数字提亮并用等宽数字，位数变化时字宽不跳动；
   整行不折行，窄屏由 .footer-copy 统一居中。颜色全部沿用页脚色板变量。 */
#footer .site-runtime {
    white-space: nowrap;
}

#footer .site-runtime .site-runtime-days {
    padding: 0 2px;
    color: var(--footer-text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* 最底部的免责声明一行已按需求移除，页脚到 .footer-copy 为止 */

/* ============================================
   链接下划线终态
   此处保留 !important（全站仅两处之一）：EnhancedMarkdown 插件会在 <head>
   末段注入 <style>，晚于本文件加载，其中 .toc-item / .footnote-ref /
   .footnote-backref 的 :hover 带下划线。样式来源与加载顺序都不可控，
   提高选择器特异性无法保证压过，因此 text-decoration 仍用 !important 收口。
   页脚模拟线不同：#footer 是 ID 选择器 (1,x,x)，层级已足够，去掉 !important。
   ============================================ */
a:hover,
a:focus-visible,
#footer a,
#footer a:hover,
.toc-item a:hover,
.footnote-ref a:hover,
.footnote-backref:hover {
    text-decoration: none !important;
}

#footer a,
#footer a:hover {
    border-bottom: 0;
}

/* ============================================
   顶部菜单末态高亮
   2px 指示线由中间向两侧展开到整项宽度，文字与图标一起变品牌蓝。
   放在全文件末尾并借 .nav-inner 前缀把特异性提到 (0,5,4) / 深色 (0,6,4)，
   稳定压过：
     index.css 首页首屏白字  .site-header:not(.header-scrolled) .nav-menu li a        (0,3,2)
     index.css 首页 hover     .site-header:not(.header-scrolled) .nav-menu li:hover a  (0,4,2)
     style.css 深色未滚动    html[data-theme="dark"] … .nav-menu li a                 (0,4,4)
     style.css 深色已滚动    html[data-theme="dark"] … .header-scrolled … li a        (0,5,4)
   只匹配 .nav-menu > li 顶层项，下拉面板子项沿用自己的 hover 短横线。
   不使用 !important，与「靠特异性解决」的约定一致。
   ============================================ */
html body .site-header .site-nav .nav-inner .nav-menu > li:hover::before,
html body .site-header .site-nav .nav-inner .nav-menu > li.active::before,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li:hover::before,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li.active::before {
    width: 100%;
    left: 0;
}

html body .site-header .site-nav .nav-inner .nav-menu > li:hover > a,
html body .site-header .site-nav .nav-inner .nav-menu > li.active > a,
html body .site-header .site-nav .nav-inner .nav-menu > li > a.active,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li:hover > a,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li.active > a,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li > a.active {
    color: var(--brand-deep);
}

/* ============================================
   下拉展开时：主项高亮横线与面板顶部线条合并为同一条线
   面板顶线现在位于 y = nav-h - 2 ~ nav-h + 2（4px，--nav-dropdown-accent）；
   这里把「分类」主项的指示线同步改成 4px、bottom:-2px、同色，
   两者的 y 区间 / 高度 / 颜色完全一致，视觉上只剩一条连续横线，
   顶部上箭头仍坐在这条线上。未展开时保持原来的 2px 细线，
   其它菜单项的高亮形态不受影响。
   选择器比上面的末态高亮多一层 .nav-dropdown，且位置更靠后，
   能稳定覆盖 width / left 的展开态，不使用 !important。
   ============================================ */
html body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown:hover::before,
html body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown:focus-within::before,
html body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown.open::before,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown:hover::before,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown:focus-within::before,
html[data-theme="dark"] body .site-header .site-nav .nav-inner .nav-menu > li.nav-dropdown.open::before {
    bottom: -2px;
    height: 4px;
    width: 100%;
    left: 0;
    background-color: var(--nav-dropdown-accent);
}

/* ---------- 通用分页（文章列表 / 归档 / 评论）：圆形胶囊、居中，颜色适配深浅主题 ---------- */
ol.page-navigator {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 7px;
    list-style: none;
    margin: 40px 0 0;
    padding: 0;
}

ol.page-navigator li {
    display: flex;
    align-items: center;
}

ol.page-navigator li a,
ol.page-navigator li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: var(--hover-wash);
    color: var(--text);
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    transition: background .5s ease, color .5s ease;
}

/* 省略号：无底透明 */
ol.page-navigator li span {
    background: transparent;
    color: var(--text-muted);
}

/* 数字页码：预留一圈透明描边与外偏移，hover 时品牌色描边向内贴合（复刻 lybblog 分页胶囊） */
ol.page-navigator li:not(.prev):not(.next):not(.current) a {
    outline: 1px solid transparent;
    outline-offset: 2em;
    transition: outline-color .5s ease, outline-offset .5s ease, background .5s ease, color .5s ease;
}

/* 上一页 / 下一页：圆形品牌蓝底 + CSS 绘制的 chevron 箭头（模板字符保留作无障碍文本，视觉隐藏）；
   预留透明描边与外偏移，hover 时描边向内贴合，与数字页码同款特效 */
ol.page-navigator li.prev a,
ol.page-navigator li.next a {
    position: relative;
    background: var(--brand-deep);
    color: transparent;
    padding: 0;
    outline: 1px solid transparent;
    outline-offset: 2em;
    transition: outline-color .5s ease, outline-offset .5s ease, background .5s ease;
}

ol.page-navigator li.prev a::before,
ol.page-navigator li.next a::before {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--accent-contrast);
    border-right: 2px solid var(--accent-contrast);
}

ol.page-navigator li.prev a::before {
    transform: rotate(-135deg);
}

ol.page-navigator li.next a::before {
    transform: rotate(45deg);
}

/* 当前页：实心品牌蓝底 + 白字（标注 2 蓝色） */
ol.page-navigator li.current a {
    background: var(--brand-deep);
    color: var(--accent-contrast);
    font-weight: 600;
}

/* 数字页号 hover：浅底褪去透明、数字转品牌色、品牌描边从外侧收缩贴合，不上浮 */
ol.page-navigator li:not(.prev):not(.next):not(.current) a:hover {
    background: transparent;
    color: var(--accent-hover);
    outline-color: var(--accent);
    outline-offset: 0;
}

/* 前后翻页 hover：蓝底加深、白箭头，白色描边从外侧收缩贴合 */
ol.page-navigator li.prev a:hover,
ol.page-navigator li.next a:hover {
    background: var(--accent-hover);
    color: var(--accent-contrast);
    outline-color: var(--accent-contrast);
    outline-offset: 0;
}

ol.page-navigator li.prev a:hover::before,
ol.page-navigator li.next a:hover::before {
    border-color: var(--accent-contrast);
}

/* ============================================
   全站右侧悬浮工具栏
   ============================================ */
@font-face {
    font-family: "iamlw-icon";
    src: url('../fonts/iamlw-iconfont.woff2') format('woff2');
    font-display: swap;
}

.side-toolbar {
    position: fixed;
    right: 15px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 999;
}

.side-tool-btn,
.side-tool-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50px;
    background: var(--surface-raised);
    box-shadow: 0 1px 1px rgba(var(--night-rgb), .08);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.side-tool-link {
    text-decoration: none;
}

.side-tool-btn:hover,
.side-tool-link:hover {
    background: var(--surface-hover);
    color: var(--accent);
}

/* 工具栏字体图标 */
.ti {
    font-family: "iamlw-icon" !important;
    font-style: normal;
    line-height: 1;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ti-top::before { content: "\e681"; }
.ti-qq::before { content: "\e605"; }
.ti-weixin::before { content: "\e606"; }
.ti-bottom::before { content: "\e666"; }

/* 微信扫码：悬停在按钮左侧弹出二维码 */
.ti-qrcode {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    width: 132px;
    height: 132px;
    padding: 8px;
    background-color: var(--surface-raised);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 6px 20px rgba(0, 0, 0, .12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.ti-qrcode::before {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left: 8px solid var(--surface-raised);
}

.side-tool-btn:hover .ti-qrcode,
.side-tool-btn:focus-within .ti-qrcode {
    opacity: 1;
    visibility: visible;
}

/* 返回顶部：未下滑时隐藏，滚动后由 JS 加 .is-show-top 显示 */
.side-tool-btn[data-side-action="top"] {
    display: none;
}

.side-toolbar.is-show-top .side-tool-btn[data-side-action="top"] {
    display: flex;
}

@media (max-width: 768px) {
    .side-toolbar { right: 12px; gap: 6px; }
    .side-tool-btn,
    .side-tool-link { width: 36px; height: 36px; }
    .ti { font-size: 14px; }
    .ti-qrcode { width: 110px; height: 110px; }
}

/* ============================================
   评论编辑器
   结构：.tedt > .bar(工具栏) + .area(文本域)
   图标：assets/images/editor.gif 20px 精灵图
   ============================================ */
#comments .comments-title,
#comments .respond-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0 0 16px;
}

#comments .respond {
    margin-top: 24px;
}

#comments .cancel-comment-reply {
    margin-bottom: 10px;
    font-size: 13px;
}

#comments .cancel-comment-reply a {
    color: var(--link);
    text-decoration: none;
}

#comments .cancel-comment-reply a:hover {
    color: var(--accent-hover);
}

/* ---------- 访客信息行：称呼 / Email / 网站 ---------- */
.editor-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.editor-meta .meta-field {
    position: relative;
}

.editor-meta .text {
    height: 34px;
    width: 100%;
    padding: 0 12px 0 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .2s ease;
}

/* placeholder 仅作为“是否已填写”的判定锚点，文字由左侧覆盖层承担 */
.editor-meta .text::placeholder {
    color: transparent;
}

/* 输入框内左侧：标签词 + 必填/选填标注 覆盖层 */
.editor-meta .field-label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    pointer-events: none;
}

.editor-meta .label-text {
    color: var(--body);
}

.editor-meta .required-mark,
.editor-meta .optional-mark {
    font-size: 12px;
    font-style: normal;
    line-height: 1;
}

.editor-meta .required-mark {
    color: var(--danger);
}

.editor-meta .optional-mark {
    color: var(--text-muted);
}

/* 聚焦或已填写时：标签词常驻，仅隐藏必填/选填标注，输入内容接在标签词后 */
.editor-meta .text:focus ~ .field-label .required-mark,
.editor-meta .text:focus ~ .field-label .optional-mark,
.editor-meta .text:not(:placeholder-shown) ~ .field-label .required-mark,
.editor-meta .text:not(:placeholder-shown) ~ .field-label .optional-mark {
    visibility: hidden;
}

.editor-login {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.editor-login a {
    color: var(--link);
    text-decoration: none;
}

/* ---------- 编辑器外壳 ---------- */
.discuz-editor {
    position: relative;
}

.discuz-editor .tedt {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-raised);
}

/* ---------- 工具栏 ---------- */
.discuz-editor .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 30px;
    padding: 0 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.discuz-editor .fpd {
    display: flex;
    align-items: center;
    gap: 2px;
}

.discuz-editor .fpd a {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0 5px 0 0;
    background-image: url('../images/editor.gif');
    background-repeat: no-repeat;
    text-indent: -9999px;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.discuz-editor .fpd a:hover {
    background-color: var(--hover-wash);
}

/* 精灵图定位（20px 一格） */
.discuz-editor .fpd .fbld { background-position: 0 0; }
.discuz-editor .fpd .fclr { background-position: -60px 0; }
.discuz-editor .fpd .fmg  { background-position: 0 -20px; }
.discuz-editor .fpd .flnk { background-position: -40px -20px; }
.discuz-editor .fpd .fsml { background-position: -20px -20px; }
.discuz-editor .fpd .fcd  { background-position: -120px -20px; }
.discuz-editor .fpd .fqt  { background-position: -140px -20px; }

/* ---------- 文本域 ---------- */
.discuz-editor .area {
    padding: 4px;
}

.discuz-editor .textarea {
    display: block;
    width: 100%;
    height: 88px;
    min-height: 88px;
    padding: 10px 12px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
}

.discuz-editor .textarea::placeholder {
    color: var(--text-muted);
}

/* ---------- 底部操作栏：提交按钮 + 提示 ---------- */
.discuz-editor .editor-foot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 10px 0 0;
    padding: 0 2px;
}

.discuz-editor .pn.pnc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 18px;
    border: 1px solid var(--brand-deep);
    border-radius: 5px;
    background: var(--brand-deep);
    color: var(--accent-contrast);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 0 var(--line);
    transition: background .15s ease, border-color .15s ease;
}

.discuz-editor .pn.pnc:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ---------- 表情面板（JS 弹出） ---------- */
.discuz-editor .smiley-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    width: 264px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-raised);
    box-shadow: var(--nav-dropdown-shadow);
}

.discuz-editor .smiley-panel.open {
    display: grid;
}

.discuz-editor .smiley-panel button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
}

.discuz-editor .smiley-panel button:hover {
    background: var(--hover-wash);
}

/* ---------- 图片 / 链接弹窗 ---------- */
.discuz-editor .editor-dialog {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 30;
    width: 420px;
    max-width: calc(100% - 16px);
    padding: 18px 18px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--nav-dropdown-shadow);
    display: none;
}

.discuz-editor .editor-dialog.open {
    display: block;
}

.discuz-editor .dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: var(--muted);
    color: var(--on-dark);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.discuz-editor .dialog-close:hover {
    background: var(--text-muted);
}

.discuz-editor .dialog-field {
    margin-bottom: 14px;
    padding-right: 36px;
}

.discuz-editor .dialog-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-strong);
}

.discuz-editor .dlg-input {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .2s ease;
}

.discuz-editor .dlg-input:focus {
    border-color: var(--brand-blue);
}

.discuz-editor .dialog-row {
    display: flex;
    gap: 18px;
}

.discuz-editor .dlg-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.discuz-editor .dlg-inline label {
    margin: 0;
    white-space: nowrap;
}

.discuz-editor .dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.discuz-editor .dlg-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--hover-wash);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease;
}

.discuz-editor .dlg-cancel:hover {
    background: var(--surface-hover);
}

.discuz-editor .fpd .fsml {
    position: relative;
}

/* ---------- 深色模式适配 ---------- */
html[data-theme="dark"] .discuz-editor .bar {
    background: var(--surface);
}

html[data-theme="dark"] .discuz-editor .fpd a {
    background-color: var(--surface);
}

html[data-theme="dark"] .discuz-editor .fpd a:hover {
    background-color: var(--surface-hover);
}

html[data-theme="dark"] .discuz-editor .pn.pnc {
    background: var(--brand-deep);
    border-color: var(--brand-deep);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .discuz-editor .pn.pnc:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ============================================
   评论列表（左头像，右姓名行 / 元信息行 / 内容）
   ============================================ */
.commentlist {
    margin-top: 32px;
}

.comment-tab {
    position: relative;
    border-bottom: 1px solid var(--line);
}

/* 左端品牌蓝短粗线：叠在通栏线最左侧（参照参考站 .comment-tab::after） */
.comment-tab::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 65px;
    height: 2px;
    background: var(--brand-deep);
}

.comment-tab .come-comt {
    padding-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
}

.comment-tab .comment-count {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
}

.comment-tab .cmt-count-num {
    color: var(--danger);
    font-weight: 600;
}

ol.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list .comment-body {
    padding: 14px 0 10px;
    border-bottom: 1px solid var(--line);
}

.comment-list .comment-body:last-child {
    border-bottom: 0;
}

.comment-list .comment-body.has-children {
    border-bottom: 0;
}

.cmt-item {
    display: flex;
    gap: 10px;
}

.cmt-avatar {
    flex: 0 0 40px;
    width: 40px;
}

.cmt-avatar img {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    padding: 1px;
    background: var(--surface);
}

.cmt-main {
    flex: 1;
    min-width: 0;
}

.cmt-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 2px;
    font-size: 14.4px;
    color: var(--muted);
}

.cmt-author {
    color: var(--text-strong);
    font-weight: 600;
}

.cmt-author a {
    color: var(--text-strong);
    text-decoration: none;
}

.cmt-author a:hover {
    color: var(--accent-hover);
}

.cmt-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 4px;
    background: var(--brand-blue);
    color: var(--accent-contrast);
    font-size: 11px;
    line-height: 18px;
}

.cmt-ua {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cmt-ua-icon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: block;
}

.cmt-ua-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cmt-ua-item::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background: rgba(var(--night-rgb), .94);
    color: var(--on-dark);
    font-size: 12px;
    line-height: 1.4;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 20;
}

.cmt-ua-item::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(var(--night-rgb), .94);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 20;
}

.cmt-ua-item:hover::after,
.cmt-ua-item:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cmt-floor {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.cmt-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 5px;
    font-size: 13px;
    color: var(--text-muted);
}

.cmt-meta time {
    color: var(--text-muted);
}

.cmt-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.cmt-area {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cmt-reply a {
    color: var(--link);
    text-decoration: none;
}

.cmt-reply a:hover {
    color: var(--accent-hover);
}

.cmt-content {
    padding-top: 6px;
    font-size: 14.4px;
    line-height: 1.7;
    color: var(--text);
    overflow-wrap: break-word;
}

.cmt-content p {
    margin: 0 0 6px;
}

.cmt-content p:last-child {
    margin-bottom: 0;
}

.comment-children {
    margin: 10px 0 0 20px;
    padding-left: 16px;
    border-left: 3px solid var(--line);
}

.comment-children .comment-body {
    border-bottom: 0;
    padding: 10px 0;
}

.comment-awaiting-moderation {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    font-style: normal;
}

html[data-theme="dark"] .cmt-avatar img {
    border-color: var(--line);
    background: var(--surface);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 768px) {
    .editor-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .discuz-editor .editor-foot {
        flex-wrap: wrap;
    }

    .discuz-editor .dialog-row {
        flex-direction: column;
        gap: 10px;
    }

    .cmt-avatar,
    .cmt-avatar img {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .comment-children {
        margin-left: 10px;
        padding-left: 12px;
    }
}
