/* ============ 唐·栖凤楼 · 志异风月主题 v3 ============ */

/* ---------- 主容器 ai ---------- */
ai {
    display: block;
    padding: 12px;
    background: 
        radial-gradient(circle at 20% 10%, rgba(168,50,50,0.04), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(139,90,43,0.05), transparent 40%),
        linear-gradient(135deg, #fdf6e3 0%, #f4e8d0 100%);
    border: 1px solid #c9a876;
    border-radius: 6px;
    box-shadow: 
        inset 0 0 20px rgba(168,50,50,0.05),
        0 2px 8px rgba(89,52,26,0.15);
    color: #3a2818;
    font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
    line-height: 1.85;
    position: relative;
}

ai::before {
    content: "栖凤";
    position: absolute;
    top: 6px;
    right: 12px;
    font-size: 11px;
    color: #a83232;
    opacity: 0.35;
    letter-spacing: 3px;
    writing-mode: vertical-rl;
    font-weight: bold;
    pointer-events: none;
}

/* ---------- 思维链 cot ---------- */
cot {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    opacity: 0.75;
}

cot > details {
    background: linear-gradient(135deg, #2a1f18 0%, #3d2b1f 100%);
    border: 1px solid #8b5a2b;
    border-radius: 4px;
    padding: 8px 12px;
    color: #d4b896;
}

cot > details > summary {
    cursor: pointer;
    color: #e8c580;
    font-weight: 600;
    letter-spacing: 1px;
    transition: color 0.3s;
}

cot > details > summary:hover {
    color: #ffd97a;
    text-shadow: 0 0 6px rgba(255,217,122,0.4);
}

cot > details[open] > summary {
    border-bottom: 1px dashed #8b5a2b;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

/* ---------- 状态栏 ---------- */
statusTop, statusBottom {
    display: block;
    margin: 12px 0;
}

statusTop details, statusBottom details {
    margin: 8px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, 
        rgba(253,246,227,0.9) 0%, 
        rgba(244,232,208,0.9) 100%);
    border: 1px solid #c9a876;
    border-left: 3px solid #a83232;
    border-radius: 4px;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 1px 3px rgba(89,52,26,0.1);
    transition: box-shadow 0.3s, border-left-color 0.3s;
}

statusTop details:hover, statusBottom details:hover {
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 2px 8px rgba(168,50,50,0.15);
    border-left-color: #d4453f;
}

statusTop summary, statusBottom summary {
    cursor: pointer;
    font-weight: 700;
    color: #8b1a1a;
    letter-spacing: 1.5px;
    padding: 2px 0;
    list-style: none;
    position: relative;
    padding-left: 18px;
    transition: color 0.3s, text-shadow 0.3s;
}

statusTop summary::before, statusBottom summary::before {
    content: "❖";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #a83232;
    font-size: 11px;
    transition: transform 0.4s;
}

statusTop details[open] summary::before, 
statusBottom details[open] summary::before {
    transform: translateY(-50%) rotate(90deg);
    color: #d4453f;
}

statusTop summary:hover, statusBottom summary:hover {
    color: #d4453f;
    text-shadow: 0 0 4px rgba(212,69,63,0.3);
}

statusTop table, statusBottom table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: rgba(255,251,240,0.6);
    border: 1px solid #d4b896;
    font-size: 13px;
}

statusTop th, statusBottom th {
    background: linear-gradient(135deg, #8b1a1a 0%, #a83232 100%);
    color: #fdf6e3;
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px solid #6b1010;
    white-space: nowrap;
}

statusTop td, statusBottom td {
    padding: 6px 10px;
    border: 1px solid #d4b896;
    color: #3a2818;
    background: rgba(255,251,240,0.4);
    transition: background 0.3s;
}

statusTop tr:hover td, statusBottom tr:hover td {
    background: rgba(255,238,200,0.7);
}

statusBottom table td[colspan] {
    background: rgba(244,232,208,0.6);
    font-style: italic;
    color: #8b5a2b;
}

statusBottom details p {
    margin: 6px 0;
    padding: 6px 10px;
    background: rgba(139,90,43,0.08);
    border-left: 2px solid #8b5a2b;
    color: #5a3820;
    font-size: 13px;
    line-height: 1.7;
}

statusBottom ol {
    margin: 8px 0 0 20px;
    padding: 0;
    counter-reset: step;
    list-style: none;
}

statusBottom ol li {
    position: relative;
    padding: 6px 10px 6px 32px;
    margin-bottom: 4px;
    background: rgba(255,238,200,0.5);
    border-left: 2px solid #c9a876;
    border-radius: 3px;
    counter-increment: step;
    transition: all 0.3s;
    color: #3a2818;
}

statusBottom ol li::before {
    content: counter(step, cjk-earthly-branch);
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #a83232;
    font-weight: bold;
    font-size: 14px;
}

statusBottom ol li:hover {
    background: rgba(255,217,122,0.4);
    border-left-color: #a83232;
    transform: translateX(2px);
}

statusBottom details details {
    margin: 6px 0;
    background: rgba(255,251,240,0.5);
    border-left-color: #c9a876;
}

statusBottom details details summary {
    color: #8b5a2b;
    font-size: 13px;
}

statusBottom details details summary::before {
    color: #b8955a;
}

/* ============================================
   ★★★ 宣纸线装书·正文卷轴 ★★★
   ============================================ */

@keyframes scrollUnfurl {
    0% { opacity: 0; transform: scaleY(0.85) translateY(-10px); }
    100% { opacity: 1; transform: scaleY(1) translateY(0); }
}

@keyframes sealBreathing {
    0%, 100% { 
        box-shadow: 
            0 3px 8px rgba(139,26,26,0.5),
            inset 0 0 6px rgba(255,255,255,0.15),
            inset 0 -2px 3px rgba(0,0,0,0.25),
            0 0 10px rgba(168,50,50,0.3);
    }
    50% { 
        box-shadow: 
            0 4px 12px rgba(139,26,26,0.65),
            inset 0 0 8px rgba(255,255,255,0.25),
            inset 0 -2px 3px rgba(0,0,0,0.25),
            0 0 20px rgba(212,69,63,0.55);
    }
}

article.scroll-body {
    display: block !important;
    position: relative;
    margin: 26px 4px 30px 4px;
    padding: 20px 18px;
    background: 
        radial-gradient(circle at 15% 22%, rgba(89,52,26,0.14) 0px, transparent 3px),
        radial-gradient(circle at 87% 68%, rgba(89,52,26,0.11) 0px, transparent 2.5px),
        radial-gradient(circle at 45% 88%, rgba(89,52,26,0.09) 0px, transparent 2px),
        radial-gradient(circle at 72% 15%, rgba(89,52,26,0.10) 0px, transparent 2px),
        radial-gradient(ellipse at 10% 90%, rgba(184,120,60,0.22) 0%, transparent 25%),
        radial-gradient(ellipse at 92% 8%, rgba(184,120,60,0.18) 0%, transparent 22%),
        linear-gradient(135deg, 
            #e8d4a8 0%, 
            #d4b878 30%,
            #c9a860 60%,
            #b89544 100%);
    border-radius: 4px;
    border-left: 3px double #8b1a1a;
    border-right: 3px double #8b1a1a;
    box-shadow: 
        0 6px 22px rgba(89,52,26,0.4),
        0 2px 6px rgba(89,52,26,0.25),
        inset 0 0 40px rgba(139,90,43,0.28),
        inset 0 0 8px rgba(89,52,26,0.18);
    animation: scrollUnfurl 0.8s ease-out;
    overflow: hidden;
}

article.scroll-body::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 8px;
    width: 5px;
    background: 
        radial-gradient(circle at center 15%, #2a1810 0px, #2a1810 3px, transparent 4px),
        radial-gradient(circle at center 40%, #2a1810 0px, #2a1810 3px, transparent 4px),
        radial-gradient(circle at center 62%, #2a1810 0px, #2a1810 3px, transparent 4px),
        radial-gradient(circle at center 85%, #2a1810 0px, #2a1810 3px, transparent 4px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 2;
}

article.scroll-body::after {
    content: "咸\A通\A遗\A事";
    white-space: pre;
    position: absolute;
    top: 14px;
    right: 24px;
    font-size: 10px;
    color: #8b1a1a;
    opacity: 0.6;
    line-height: 1.5;
    font-family: "STZhongsong", "楷体", serif;
    text-align: center;
    padding: 5px 4px;
    border: 1px solid rgba(139,26,26,0.55);
    border-radius: 1px;
    pointer-events: none;
    z-index: 2;
    font-weight: bold;
}

article.scroll-body p {
    position: relative;
    margin: 0 0 18px 0;
    padding: 0 12px;
    text-indent: 2em;
    color: #1f1108;
    line-height: 2.15;
    font-family: "Noto Serif SC", "STKaiti", "楷体", serif;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-align: justify;
    z-index: 1;
    transition: color 0.4s;
}

article.scroll-body > p:first-child {
    margin-top: 8px;
    padding-top: 24px;
    padding-left: 22px;
    padding-right: 22px;
    background: 
        repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(139,90,43,0.03) 2px, rgba(139,90,43,0.03) 3px),
        linear-gradient(180deg, #fffbf0 0%, #fdf5e0 100%);
    border-top: 1px solid rgba(184,149,90,0.5);
    border-left: 1px solid rgba(184,149,90,0.5);
    border-right: 1px solid rgba(184,149,90,0.5);
    border-radius: 3px 3px 0 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

article.scroll-body > p:not(:first-child):not(:last-child) {
    padding-left: 22px;
    padding-right: 22px;
    background: 
        repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(139,90,43,0.03) 2px, rgba(139,90,43,0.03) 3px),
        linear-gradient(180deg, #fdf5e0 0%, #fbf0d6 100%);
    border-left: 1px solid rgba(184,149,90,0.5);
    border-right: 1px solid rgba(184,149,90,0.5);
    margin-bottom: 0;
    padding-top: 10px;
    padding-bottom: 10px;
}

article.scroll-body > p:last-child {
    padding-left: 22px;
    padding-right: 22px;
    padding-bottom: 34px;
    background: 
        repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(139,90,43,0.03) 2px, rgba(139,90,43,0.03) 3px),
        linear-gradient(180deg, #fbf0d6 0%, #f8ecc8 100%);
    border-left: 1px solid rgba(184,149,90,0.5);
    border-right: 1px solid rgba(184,149,90,0.5);
    border-bottom: 1px solid rgba(184,149,90,0.5);
    border-radius: 0 0 3px 3px;
    padding-top: 10px;
    margin-bottom: 4px;
}

article.scroll-body > p:only-child {
    padding: 24px 22px 34px;
    border: 1px solid rgba(184,149,90,0.5);
    border-radius: 3px;
}

article.scroll-body > p:first-child::before {
    content: "史";
    position: absolute;
    top: -14px;
    left: 18px;
    width: 32px;
    height: 32px;
    background: 
        radial-gradient(circle at 30% 30%, #d4453f 0%, #a83232 50%, #7b1010 100%);
    color: #fdf6e3;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transform: rotate(-6deg);
    font-family: "STZhongsong", "楷体", serif;
    letter-spacing: 0;
    text-indent: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    animation: sealBreathing 3.5s ease-in-out infinite;
    z-index: 3;
}

article.scroll-body > p:first-child::first-letter {
    font-size: 34px;
    font-weight: bold;
    color: #8b1a1a;
    float: left;
    line-height: 1.05;
    margin: 4px 8px 0 0;
    padding: 3px 8px;
    font-family: "STZhongsong", "楷体", serif;
    text-shadow: 
        1px 1px 2px rgba(89,52,26,0.35),
        0 0 6px rgba(139,26,26,0.2);
    border: 1.5px double #a83232;
    background: linear-gradient(135deg, rgba(255,238,200,0.5), rgba(255,251,240,0.2));
    border-radius: 3px;
}

article.scroll-body > p:last-child::after {
    content: "· 栖 凤 楼 记 ·";
    display: block;
    text-align: right;
    margin-top: 12px;
    padding-right: 6px;
    font-size: 11px;
    color: #8b1a1a;
    letter-spacing: 5px;
    font-family: "STZhongsong", "楷体", serif;
    opacity: 0.7;
    text-indent: 0;
    border-top: 1px dashed rgba(139,26,26,0.3);
    padding-top: 8px;
}

article.scroll-body > p:not(:last-child)::after {
    content: "· ◈ ·";
    display: block;
    text-align: center;
    color: #a83232;
    opacity: 0.4;
    letter-spacing: 8px;
    margin-top: 12px;
    font-size: 11px;
    text-indent: 0;
    font-weight: bold;
}

article.scroll-body p:hover {
    color: #0a0300;
}

/* ============================================
   ★ 加载中气泡·唐风朱红版 ★
   靶点尝试(rili常见loading类)
   ============================================ */

@keyframes inkDrop {
    0%, 80%, 100% { 
        transform: scale(0.6); 
        opacity: 0.4;
    }
    40% { 
        transform: scale(1.1); 
        opacity: 1;
    }
}

@keyframes brushStroke {
    0% { width: 0; opacity: 0.3; }
    50% { width: 100%; opacity: 1; }
    100% { width: 0; opacity: 0.3; }
}

/* 通用loading选择器矩阵·尽可能命中 */
.loading, 
.loading-bubble, 
.chat-loading,
.message-loading,
.ai-loading,
[class*="loading"] .bubble,
[class*="Loading"],
.typing-indicator,
.thinking {
    position: relative !important;
    display: inline-block !important;
    padding: 12px 22px !important;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255,238,200,0.4) 0%, transparent 60%),
        linear-gradient(135deg, #e8d4a8 0%, #d4b878 60%, #c9a860 100%) !important;
    border: 1px solid #a83232 !important;
    border-left: 3px double #8b1a1a !important;
    border-right: 3px double #8b1a1a !important;
    border-radius: 4px !important;
    box-shadow: 
        0 4px 12px rgba(89,52,26,0.3),
        inset 0 0 20px rgba(139,90,43,0.2),
        inset 0 1px 0 rgba(255,255,255,0.4) !important;
    color: #8b1a1a !important;
    font-family: "STZhongsong", "楷体", serif !important;
    font-size: 12px !important;
    letter-spacing: 4px !important;
    min-width: 90px !important;
    text-align: center !important;
    animation: scrollUnfurl 0.6s ease-out !important;
}

/* 三点墨滴动画·替换默认loading内容 */
.loading::before, 
.loading-bubble::before,
.chat-loading::before,
.message-loading::before,
.ai-loading::before,
.typing-indicator::before,
.thinking::before {
    content: "史 官 · 挥 毫";
    display: inline-block;
    color: #8b1a1a;
    font-weight: bold;
    margin-right: 8px;
    text-shadow: 0 1px 2px rgba(89,52,26,0.3);
}

.loading::after,
.loading-bubble::after,
.chat-loading::after,
.message-loading::after,
.ai-loading::after,
.typing-indicator::after,
.thinking::after {
    content: "●●●";
    display: inline-block;
    color: #a83232;
    letter-spacing: 4px;
    animation: inkDrop 1.4s infinite ease-in-out;
    font-size: 10px;
}

/* 保底方案·如果原loading内含子元素·统一美化 */
.loading > *,
.loading-bubble > *,
.chat-loading > *,
[class*="loading"] > .dot,
[class*="loading"] > span {
    background: radial-gradient(circle, #a83232 0%, #8b1a1a 100%) !important;
    border-radius: 50% !important;
    box-shadow: 0 0 4px rgba(168,50,50,0.5) !important;
}

/* ---------- 移动端适配 ---------- */
@media screen and (max-width: 600px) {
    ai { padding: 8px; }
    article.scroll-body {
        margin: 20px 2px 24px;
        padding: 16px 10px;
        border-left-width: 2px;
        border-right-width: 2px;
    }
    article.scroll-body::before { left: 4px; width: 4px; }
    article.scroll-body::after { font-size: 9px; top: 10px; right: 14px; }
    article.scroll-body p { font-size: 14px; line-height: 2.0; }
    article.scroll-body > p:first-child { padding: 20px 14px 8px 16px; }
    article.scroll-body > p:not(:first-child):not(:last-child) { padding: 8px 14px 8px 16px; }
    article.scroll-body > p:last-child { padding: 8px 14px 28px 16px; }
    article.scroll-body > p:only-child { padding: 20px 14px 28px; }
    article.scroll-body > p:first-child::before { width: 26px; height: 26px; font-size: 14px; left: 12px; top: -12px; }
    article.scroll-body > p:first-child::first-letter { font-size: 28px; }
    article.scroll-body > p:last-child::after { letter-spacing: 3px; font-size: 10px; }
    article.scroll-body > p:not(:last-child)::after { letter-spacing: 5px; font-size: 10px; }
    statusTop table, statusBottom table { font-size: 12px; }
    statusTop th, statusBottom th, statusTop td, statusBottom td { padding: 4px 6px; }
    statusTop summary, statusBottom summary { font-size: 13px; }
    [class*="loading"], .thinking, .typing-indicator { 
        padding: 10px 16px !important; 
        font-size: 11px !important; 
    }
}
/* 员工合并表·花名单元格垂直居中+朱红加粗 */
statusBottom table td[rowspan="2"] {
    vertical-align: middle;
    text-align: center;
    background: linear-gradient(180deg, rgba(168,50,50,0.15), rgba(139,26,26,0.08)) !important;
    color: #8b1a1a !important;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: "STZhongsong", "楷体", serif;
    border-right: 2px solid #a83232 !important;
}

/* 身体开发详情副表头强调 */
statusBottom table th[colspan="8"] {
    background: linear-gradient(135deg, #a83232, #6b1010) !important;
    color: #fdf6e3 !important;
    font-size: 12px;
    letter-spacing: 3px;
    padding: 4px 8px !important;
}

/* ============ 员工表·横向滚动容器 ============ */

/* 滚动外壳 */
.emp-table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    margin-top: 8px;
    padding-bottom: 6px;
    position: relative;
    
    /* 边缘提示阴影·暗示可滚动 */
    background:
        linear-gradient(90deg, rgba(255,251,240,0.9), transparent 15%, transparent 85%, rgba(255,251,240,0.9)),
        linear-gradient(90deg, rgba(168,50,50,0.15), transparent 8%, transparent 92%, rgba(168,50,50,0.15));
    background-attachment: local, scroll;
    border-radius: 4px;
}

/* 滚动条·唐风朱红细条 */
.emp-table-scroll::-webkit-scrollbar {
    height: 8px;
    background: rgba(184,149,90,0.15);
    border-radius: 4px;
}

.emp-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #8b1a1a 0%, #a83232 50%, #8b1a1a 100%);
    border-radius: 4px;
    box-shadow: inset 0 0 3px rgba(255,255,255,0.2);
    transition: background 0.3s;
}

.emp-table-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #a83232 0%, #d4453f 50%, #a83232 100%);
}

.emp-table-scroll::-webkit-scrollbar-track {
    background: rgba(139,90,43,0.1);
    border-radius: 4px;
}

/* 内部表格·强制不换行·必要时超出 */
.emp-table-scroll > table {
    width: max-content;
    min-width: 100%;
    white-space: nowrap;
    margin-top: 0 !important;
}

/* 单元格内容允许纵向排列的·如身体开发详情长文本·可换行 */
.emp-table-scroll > table td[colspan] {
    white-space: normal;
    min-width: 400px;
    max-width: 700px;
}

/* 移动端·加"←滑动→"提示 */
@media screen and (max-width: 600px) {
    .emp-table-scroll {
        position: relative;
    }
    .emp-table-scroll::after {
        content: "← 左右滑动查看 →";
        display: block;
        text-align: center;
        font-size: 10px;
        color: #a83232;
        opacity: 0.6;
        letter-spacing: 3px;
        padding: 4px 0 0 0;
        font-family: "STZhongsong", "楷体", serif;
        pointer-events: none;
    }
    
    .emp-table-scroll::-webkit-scrollbar {
        height: 6px;
    }
    
    .emp-table-scroll > table {
        font-size: 11px;
    }
    
    .emp-table-scroll > table th,
    .emp-table-scroll > table td {
        padding: 4px 6px !important;
    }
}

/* 花名列·横向滚动时保持左侧粘性(可选高级效果) */
.emp-table-scroll > table td[rowspan="2"],
.emp-table-scroll > table th[rowspan="2"] {
    position: sticky;
    left: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(232,212,168,0.98) 0%, rgba(200,168,110,0.98) 100%) !important;
    box-shadow: 3px 0 6px rgba(89,52,26,0.25);
    border-right: 2px solid #a83232 !important;
}