/* ==================== v6 U4 + U4b（2026-09-27）人类思维链 ====================
   enabled/expanded 分离：开启后输入框上方是**单行悬浮入口条**，点它才展开面板，
   「收起」折回入口条（不关功能），装备栏再点才彻底关。
   消息流里：独立轻量「思考链」row（user 消息后、AI 回复前），不包 user 气泡。
   不进记忆/蒸馏/摘要/Discord；草稿只存本地。 */

/* ─────────── 输入框上方：编辑条（U4f，参考 输入框上方思考链.jpg） ───────────
   第一行标题「人类思维链」，第二行 Core 淡字预览（没写=「写点这一轮的想法…」）；
   持续轮次不放条上（展开后的面板里）。颜色全走主题变量/inherit+opacity。 */

.thought-chain-bar.ht-chip-mode {
    display: block;
    margin: 0 14px 6px;
    padding: 0;
    border: none;
    background: transparent;
}

.thought-chain-bar .ht-chip-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 12px;
    background: color-mix(in srgb, currentColor 5%, transparent);
    color: inherit;
    padding: 7px 14px;
    cursor: pointer;
}

.thought-chain-bar .ht-chip-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: inherit;
    letter-spacing: 0.05em;
}

.thought-chain-bar .ht-chip-arrow {
    margin-left: auto;
    opacity: 0.6;
}

/* ─────────── 展开面板 ─────────── */

.thought-chain-bar {
    display: none;
    margin: 0 14px 6px;
    padding: 8px 10px;
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 10px;
    background: rgba(128, 128, 128, 0.07);
    font-size: 0.85rem;
}

.thought-chain-bar .ht-bar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.thought-chain-bar .ht-bar-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--accent, #4a9eff);
    letter-spacing: 0.05em;
}

.thought-chain-bar .ht-duration {
    margin-left: auto;
    font-size: 0.78rem;
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    padding: 2px 4px;
}

.thought-chain-bar .ht-bar-close {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.6;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 4px;
}

.thought-chain-bar .ht-core,
.thought-chain-bar .ht-body {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.85rem;
    padding: 6px 8px;
    margin-bottom: 6px;
    resize: vertical;
}

.thought-chain-bar .ht-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
}

.thought-chain-bar .ht-chip {
    border: 1px solid rgba(128, 128, 128, 0.35);
    background: transparent;
    color: inherit;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 3px 10px;
    cursor: pointer;
}

.thought-chain-bar .ht-chip.on {
    background: var(--accent, #4a9eff);
    border-color: var(--accent, #4a9eff);
    color: #fff;
}

.thought-chain-bar .ht-custom-row {
    display: flex;
    gap: 6px;
    margin-top: 5px;
}

.thought-chain-bar .ht-custom-input {
    flex: 1;
    min-width: 0;
    border: 1px dashed rgba(128, 128, 128, 0.4);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 0.78rem;
    padding: 4px 8px;
}

.thought-chain-bar .ht-sliders {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 5px;
}

.thought-chain-bar .ht-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thought-chain-bar .ht-slider-name {
    flex: none;
    width: 3em;
    font-size: 0.78rem;
    opacity: 0.85;
}

.thought-chain-bar .ht-slider-row input[type="range"] { flex: 1; accent-color: var(--accent, #4a9eff); }
.thought-chain-bar .ht-slider-row input[type="number"] {
    width: 64px;
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    padding: 2px 6px;
}
.thought-chain-bar .ht-slider-v {
    flex: none;
    width: 2.6em;
    text-align: right;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.thought-chain-bar .ht-bar-hint {
    margin-top: 6px;
    font-size: 0.7rem;
    opacity: 0.55;
}


/* ─────────── 消息流里的「思考链」（U4f 视觉，克克 9-27 收） ───────────
   参考 类似的user气泡上方思考链.jpg：收起只有一行「› 思考链」；展开是一块跟主题同色的浅磨砂块。
   颜色只用主题变量 --text / --accent-rgb（默认蓝、锈湖、Claude、ChatGPT 各自带），不写死颜色、不用彩色左边条。
   选择器带 #character-chat-messages 前缀，压过主题对 button 的通用样式。 */

#character-chat-messages .ht-message-surface {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    align-self: flex-end;
    max-width: 78%;
    min-width: 0;
    margin: 6px 14px 2px;
    background: transparent;
    border: none;
}

/* 收起：一行小字 */
#character-chat-messages .ht-message-surface .ht-surface-header {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 2px 2px;
    margin: 0;
    font: inherit;
    font-size: 11.5px;
    letter-spacing: 0.14em;
    color: var(--text, currentColor);
    opacity: 0.5;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease;
}
#character-chat-messages .ht-message-surface .ht-surface-header:hover,
#character-chat-messages .ht-message-surface .ht-surface-header:active { opacity: 0.8; }
#character-chat-messages .ht-message-surface .ht-surface-arrow {
    display: inline-block;
    width: 0.8em;
    text-align: center;
    font-size: 0.95em;
    line-height: 1;
}

/* 展开：浅磨砂块，右上角收一点，像从那行小字里垂下来 */
#character-chat-messages .ht-message-surface .ht-surface-detail {
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    margin-top: 4px;
    padding: 10px 14px 9px;
    border-radius: 16px 4px 16px 16px;
    background: rgba(var(--accent-rgb, 120, 132, 140), 0.14);
    border: 1px solid rgba(var(--accent-rgb, 120, 132, 140), 0.26);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--text, currentColor);
    font-size: 0.84rem;
    line-height: 1.65;
    text-align: left;
    animation: ht-surface-in 0.18s ease-out;
}
#character-chat-messages .ht-message-surface .ht-surface-detail[hidden] { display: none; }

@keyframes ht-surface-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

#character-chat-messages .ht-surface-core {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

#character-chat-messages .ht-surface-body {
    white-space: pre-wrap;
    word-break: break-word;
    opacity: 0.9;
}

/* 情绪和状态是页脚：一根发丝线隔开，字小、淡 */
#character-chat-messages .ht-surface-emotions,
#character-chat-messages .ht-surface-state {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    opacity: 0.58;
}
#character-chat-messages .ht-surface-emotions {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(var(--accent-rgb, 120, 132, 140), 0.18);
}
#character-chat-messages .ht-surface-state { margin-top: 2px; }
#character-chat-messages .ht-surface-core + .ht-surface-state,
#character-chat-messages .ht-surface-body + .ht-surface-state {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(var(--accent-rgb, 120, 132, 140), 0.18);
}

#character-chat-messages .ht-surface-state .ht-surface-end {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    cursor: pointer;
}
#character-chat-messages .ht-surface-state .ht-surface-end:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    #character-chat-messages .ht-message-surface .ht-surface-detail { animation: none; }
}
