/* ============================================================
   主题预设体系（data-theme 驱动）
   aurora-glass（默认/玻璃拟态增强）| neumorphic（新拟物派）| organic（自然有机）
   设计令牌：动效时长/缓动统一管理
   ============================================================ */

/* ---------- 全局动效令牌 ---------- */
:root {
    --dur-fast: 150ms;
    --dur-base: 300ms;
    --dur-slow: 500ms;
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-raised: none;
    --shadow-inset: none;
    --shadow-hover: none;
    --shadow-active: none;
    --font-heading: inherit;
    --card-border: 1px solid var(--glass-border);
    /* 控件描边兜底色：即使主题未定义也不会退化成透明 */
    --control-border: rgba(15, 23, 42, 0.18);
}

/* ---------- aurora-glass：玻璃拟态（默认，沿用 buildThemeCSS 变量） ---------- */
html[data-theme="aurora-glass"] {
    --card-border: 1px solid var(--glass-border);
}

/* ---------- neumorphic：新拟物派 ---------- */
html[data-theme="neumorphic"] {
    --bg-start: #e0e5ec;
    --bg-end: #e0e5ec;
    --glass: #e0e5ec;
    --glass-hover: #e4e9f0;
    --glass-border: transparent;
    --text: #333333;
    --text-light: #6b7280;
    --sidebar-bg: #e0e5ec;
    --sidebar-link: #6b7280;
    --sidebar-link-hover: #333333;
    --sidebar-link-hover-bg: rgba(109, 93, 252, 0.12);
    --shadow: 8px 8px 16px #b8bcc2, -8px -8px 16px #ffffff;
    --shadow-raised: 8px 8px 16px #b8bcc2, -8px -8px 16px #ffffff;
    --shadow-hover: 4px 4px 8px #b8bcc2, -4px -4px 8px #ffffff;
    --shadow-inset: inset 6px 6px 12px #b8bcc2, inset -6px -6px 12px #ffffff;
    --shadow-active: inset 4px 4px 8px #b8bcc2, inset -4px -4px 8px #ffffff;
    --radius: 16px;
    --card-border: none;
}

html[data-theme="neumorphic"] body {
    background: var(--bg-start);
}

html[data-theme="neumorphic"] .card,
html[data-theme="neumorphic"] .stat-card {
    box-shadow: var(--shadow-raised);
    border: none;
}

html[data-theme="neumorphic"] .card:hover {
    box-shadow: var(--shadow-raised);
}

html[data-theme="neumorphic"] .card-clickable:hover {
    transform: none;
    box-shadow: var(--shadow-hover);
}

html[data-theme="neumorphic"] .card-clickable:active {
    box-shadow: var(--shadow-active);
}

html[data-theme="neumorphic"] .btn {
    background: #e0e5ec;
    color: var(--text);
    box-shadow: var(--shadow-hover);
    border-radius: 12px;
}

html[data-theme="neumorphic"] .btn:hover {
    box-shadow: 2px 2px 4px #b8bcc2, -2px -2px 4px #ffffff;
    transform: none;
    filter: none;
}

html[data-theme="neumorphic"] .btn:active {
    box-shadow: var(--shadow-active);
}

html[data-theme="neumorphic"] .btn-primary {
    background: var(--c-primary);
    color: #fff;
}

html[data-theme="neumorphic"] .btn-secondary {
    background: var(--c-secondary);
    color: #fff;
}

html[data-theme="neumorphic"] .form-input,
html[data-theme="neumorphic"] .form-select,
html[data-theme="neumorphic"] .form-textarea {
    background: #e0e5ec;
    border: none;
    box-shadow: var(--shadow-inset);
}

html[data-theme="neumorphic"] .form-input:focus,
html[data-theme="neumorphic"] .form-select:focus,
html[data-theme="neumorphic"] .form-textarea:focus {
    box-shadow: inset 2px 2px 4px #b8bcc2, inset -2px -2px 4px #ffffff;
    border: none;
}

html[data-theme="neumorphic"] .bg-shape {
    display: none;
}

/* ---------- organic：自然有机风 ---------- */
html[data-theme="organic"] {
    --bg-start: #faf6f1;
    --bg-end: #f3ede4;
    --glass: #faf6f1;
    --glass-hover: #f5efe6;
    --glass-border: rgba(92, 64, 51, 0.14);
    --control-border: rgba(92, 64, 51, 0.24);
    --text: #5c4033;
    --text-light: #7d6b5d;
    --text-muted: #a8968a;
    --shadow: 0 2px 10px rgba(92, 64, 51, 0.08);
    --radius: 2rem;
    --card-border: 1px solid rgba(92, 64, 51, 0.14);
    --font-heading: 'Noto Serif SC', 'Songti SC', serif;
    --dur-base: 500ms;
    --sidebar-bg: #5c4033;
    --sidebar-link: rgba(250, 246, 241, 0.65);
    --sidebar-link-hover: #faf6f1;
    --sidebar-link-hover-bg: rgba(250, 246, 241, 0.12);
}

html[data-theme="organic"] .card,
html[data-theme="organic"] .stat-card {
    border-radius: 2rem;
}

html[data-theme="organic"] .btn {
    border-radius: 999px;
}

html[data-theme="organic"] .card-clickable:hover {
    transform: translateY(1px);
    box-shadow: 0 3px 12px rgba(92, 64, 51, 0.12);
}

html[data-theme="organic"] h1,
html[data-theme="organic"] h2,
html[data-theme="organic"] h3,
html[data-theme="organic"] .section-title,
html[data-theme="organic"] .stat-value {
    font-family: var(--font-heading);
}

html[data-theme="organic"] .form-textarea {
    border-radius: 1.25rem;
}

html[data-theme="organic"] .form-input,
html[data-theme="organic"] .form-select {
    border-radius: 999px;
    border-color: rgba(92, 64, 51, 0.2);
    background: #fff;
}

html[data-theme="organic"] .modal-box,
html[data-theme="organic"] .toast {
    border-radius: 1.5rem;
}

/* ---------- 组件主题统一（弹窗/下拉/提示浮层跟随主题变量） ---------- */
/* 用 html[data-theme] 前缀提高特异性，覆盖模板内联 <style> 的同名硬编码 */
html[data-theme] .modal-box,
html[data-theme] .user-dropdown,
html[data-theme] .custom-select-list,
html[data-theme] .custom-select-btn,
html[data-theme] #api-dropdown,
html[data-theme] .json-context-menu,
html[data-theme] .toast,
html[data-theme] .tooltip-content {
    background: var(--glass-solid, #fff);
    border-color: var(--glass-border);
    color: var(--text);
}

.custom-select-item {
    color: var(--text);
}

/* 表单控件/下拉按钮的描边：玻璃主题下 --glass-border 近乎透明，
   直接沿用它会让圆角控件失去轮廓，这里改用专门的控件描边色。 */
html[data-theme] .custom-select-btn,
html[data-theme] .custom-select-list,
html[data-theme] .form-select,
html[data-theme] .form-input,
html[data-theme] .form-textarea {
    border: 1px solid var(--control-border);
}

/* 原生 select 的 CSS 箭头：描边生效后仍要保留右侧留白 */
html[data-theme] .form-select {
    padding-right: 32px;
}

html[data-theme] .custom-select-btn:hover,
html[data-theme] .custom-select-btn.open,
html[data-theme] .form-select:focus,
html[data-theme] .form-input:focus,
html[data-theme] .form-textarea:focus {
    border-color: var(--c-primary, #8b5cf6);
}

.form-select option {
    background: var(--glass-solid, #fff);
    color: var(--text);
}

/* 各主题的实底表面色（弹窗/下拉不可半透明） */
html[data-theme="aurora-glass"] {
    --glass-solid: #ffffff;
    --control-border: rgba(15, 23, 42, 0.18);
}

html[data-theme="aurora-glass"] .custom-select-btn,
html[data-theme="aurora-glass"] .custom-select-list,
html[data-theme="aurora-glass"] .form-select,
html[data-theme="aurora-glass"] .form-input,
html[data-theme="aurora-glass"] .form-textarea {
    border: 1px solid var(--control-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html[data-theme="neumorphic"] {
    --glass-solid: #e0e5ec;
}

html[data-theme="neumorphic"] .modal-box,
html[data-theme="neumorphic"] .user-dropdown,
html[data-theme="neumorphic"] .custom-select-list,
html[data-theme="neumorphic"] .custom-select-btn,
html[data-theme="neumorphic"] .toast,
html[data-theme="neumorphic"] #api-dropdown {
    box-shadow: var(--shadow-raised);
    border: none;
}

html[data-theme="neumorphic"] .form-select option,
html[data-theme="neumorphic"] .form-input,
html[data-theme="neumorphic"] .form-select,
html[data-theme="neumorphic"] .form-textarea {
    background: #e0e5ec;
}

html[data-theme="organic"] {
    --glass-solid: #faf6f1;
}

/* organic 主题组件圆角统一（适中有机圆角，避免椭圆化） */
html[data-theme="organic"] .modal-box,
html[data-theme="organic"] .user-dropdown,
html[data-theme="organic"] .custom-select-list,
html[data-theme="organic"] .custom-select-btn,
html[data-theme="organic"] .toast,
html[data-theme="organic"] #api-dropdown,
html[data-theme="organic"] .theme-pop {
    border-radius: 1.25rem;
}

html[data-theme="neumorphic"] .theme-pop {
    box-shadow: var(--shadow-raised);
    border: none;
}

/* ---------- 后台侧边栏主题化与动效 ---------- */
html[data-theme] .sidebar {
    background: var(--sidebar-bg, #1e293b);
    transition: background var(--dur-base) var(--ease-out-quart);
}

html[data-theme="neumorphic"] .sidebar {
    --sidebar-bg: #d8dee7;
}

html[data-theme="organic"] .sidebar {
    --sidebar-bg: #5c4033;
}

html[data-theme] .sidebar-menu a {
    position: relative;
    overflow: hidden;
    transition: background var(--dur-fast) var(--ease-out-quart), color var(--dur-fast) var(--ease-out-quart), padding-left var(--dur-fast) var(--ease-out-quart);
}

html[data-theme] .sidebar-menu a i,
html[data-theme] .sidebar-menu a svg {
    width: 15px;
    height: 15px;
    transition: transform var(--dur-fast) var(--ease-spring);
}

html[data-theme] .sidebar-menu a:hover {
    padding-left: 16px;
}

html[data-theme] .sidebar-menu a:hover i,
html[data-theme] .sidebar-menu a:hover svg {
    transform: scale(1.15);
}

html[data-theme] .sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 3px;
    background: #fff;
    animation: slideIn 0.25s var(--ease-out-quart);
}

@keyframes slideIn {
    from {
        transform: scaleY(0);
    }
}

/* organic 主题侧栏文字色适配深棕背景 */
html[data-theme="organic"] .sidebar-logo,
html[data-theme="organic"] .sidebar-menu a,
html[data-theme="organic"] .sidebar-version {
    color: rgba(250, 246, 241, 0.75);
}

html[data-theme="organic"] .sidebar-logo {
    color: #faf6f1;
}

html[data-theme="organic"] .sidebar-menu a.active {
    color: #faf6f1;
}

/* neumorphic 主题侧栏文字色适配浅灰背景 */
html[data-theme="neumorphic"] .sidebar-logo {
    color: #333;
}

html[data-theme="neumorphic"] .sidebar-menu a {
    color: #6b7280;
}

html[data-theme="neumorphic"] .sidebar-menu a:hover {
    color: #333;
    background: rgba(255, 255, 255, 0.5);
}

html[data-theme="neumorphic"] .sidebar-menu a.active {
    color: #fff;
}

html[data-theme="neumorphic"] .sidebar-version {
    color: #9aa3b0;
}

/* 侧栏底部主题按钮 */
.sidebar-bottom {
    padding: 10px 8px;
    margin-top: auto;
}

.sidebar-theme-btn.sidebar-theme-btn {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    transform: none;
}

.sidebar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
}

.sidebar-theme-btn:active {
    transform: scale(0.98);
}

.sidebar-theme-pop {
    position: fixed;
    left: auto;
    right: auto;
    bottom: auto;
    top: auto;
    transform-origin: bottom left;
}

.sidebar-theme-btn span {
    transition: opacity 0.2s;
}

@media (max-width: 768px) {
    .sidebar-theme-btn span {
        display: none;
    }
}

/* ---------- 主题切换过渡 ---------- */
body,
.card,
.btn,
.header,
.form-input,
.form-select,
.form-textarea {
    transition-property: background, color, box-shadow, border-color, background-color;
    transition-duration: var(--dur-base);
    transition-timing-function: var(--ease-out-quart);
}

/* ---------- 主题切换器 ---------- */
.theme-switcher {
    position: relative;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(var(--c-primary-rgb), 0.1);
    color: var(--text);
    cursor: pointer;
    transition: background var(--dur-base) var(--ease-out-quart), transform var(--dur-fast) var(--ease-spring);
}

.theme-btn:hover {
    background: rgba(var(--c-primary-rgb), 0.18);
    transform: rotate(30deg);
}

.theme-btn:active {
    transform: rotate(30deg) scale(0.92);
}

.theme-pop {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur, 12px));
    border: var(--card-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    padding: 8px;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: all var(--dur-base) var(--ease-out-quart);
}

.theme-pop.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.theme-pop-title {
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 8px 4px;
    letter-spacing: 0.5px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    font-family: inherit;
    transition: background var(--dur-fast) var(--ease-out-quart);
    text-align: left;
}

.theme-option:hover {
    background: rgba(var(--c-primary-rgb), 0.08);
}

.theme-option.selected {
    background: rgba(var(--c-primary-rgb), 0.12);
    color: var(--c-primary);
    font-weight: 500;
}

.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* ---------- 通用微交互增强 ---------- */

/* 点击涟漪 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: rippleGrow 0.6s var(--ease-out-quart) forwards;
    pointer-events: none;
}

@keyframes rippleGrow {
    to {
        transform: scale(3.2);
        opacity: 0;
    }
}

/* 滚动入场 */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--dur-slow) var(--ease-out-quart), transform var(--dur-slow) var(--ease-out-quart);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.in {
    opacity: 1;
    transform: translateY(0);
}

/* 下拉/模态丝滑化 */
.user-dropdown,
.custom-select-list,
.modal-box {
    transition-timing-function: var(--ease-out-quart);
    transition-duration: var(--dur-base);
}

/* ---------- 图表微动效 ---------- */
/* TOP10 进度条生长动画 */
@keyframes barGrow {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

.bar-grow {
    transform-origin: left;
    animation: barGrow 0.9s var(--ease-out-quart) backwards;
    animation-delay: var(--bar-delay, 0ms);
}

/* canvas 图表淡入 */
.chart-fade {
    animation: chartFade 0.5s var(--ease-out-quart);
}

@keyframes chartFade {
    from {
        opacity: 0;
    }
}

/* ---------- 页面切换过渡（MPA View Transitions + 回退入场动画） ---------- */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: vtOut 180ms var(--ease-out-quart) both;
}

::view-transition-new(root) {
    animation: vtIn 260ms var(--ease-out-quart) both;
}

@keyframes vtOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

@keyframes vtIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* 回退：不支持 View Transitions 的浏览器用入场淡入 */
@supports not (view-transition-name: root) {
    body {
        animation: pageIn 0.3s var(--ease-out-quart);
    }
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* 减少动态偏好：仅关闭大面积装饰动画，保留功能性动效（加载、提示、图表等） */
@media (prefers-reduced-motion: reduce) {
    .bg-shape {
        animation: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ---------- AI 生成：代码区亮度 + 思考过程预览 ---------- */
body .code-content {
    color: #e6edf3;
}

body .code-content pre,
body .code-content code {
    color: #e6edf3;
}

/* highlight.js 基础文本也提亮（令牌颜色仍由主题决定） */
body .code-content .hljs {
    color: #e6edf3;
}

body .code-content .hljs-comment,
body .code-content .hljs-quote {
    color: #9da7b3;
}

.ai-gen-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    min-height: 18px;
    overflow: hidden;
    white-space: nowrap;
}

.ai-gen-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    color: var(--c-primary);
}

.ai-think-line {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--c-primary) 45%, var(--text-muted) 90%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: thinkShimmer 2.2s linear infinite;
}

@keyframes thinkShimmer {
    0% {
        background-position: 120% 0;
    }

    100% {
        background-position: -120% 0;
    }
}

/* ---------- 加载态图标旋转（所有 loader-circle） ---------- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

[data-lucide="loader-circle"],
[data-lucide-icon="loader-circle"],
.fa-spinner {
    animation: spin 0.9s linear infinite;
    transform-origin: center;
}

/* 字体图标基础对齐：与文字基线一致，避免与文本行错位 */
i.fa-solid,
i.fa-regular,
i.fa-brands {
    display: inline-block;
    line-height: 1;
    text-align: center;
    vertical-align: -0.125em;
}

/* ============================================================
   品牌支付图标（内联 SVG 蒙版，替代 Font Awesome brands CDN）
   用法：<i class="brand-icon bi-alipay"></i>
   颜色继承 currentColor（由外层 span style 控制品牌色）
   ============================================================ */
.brand-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    background-color: currentColor;
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.brand-icon.bi-alipay {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.695 15.07c3.426 1.158 4.203 1.22 4.203 1.22V3.846c0-2.124-1.705-3.845-3.81-3.845H3.914C1.808.001.102 1.722.102 3.846v16.31c0 2.123 1.706 3.845 3.813 3.845h16.173c2.105 0 3.81-1.722 3.81-3.845v-.157s-6.19-2.602-9.315-4.119c-2.096 2.602-4.8 4.181-7.607 4.181-4.75 0-6.361-4.19-4.112-6.949.49-.602 1.324-1.175 2.617-1.497 2.025-.502 5.247.313 8.266 1.317a16.796 16.796 0 0 0 1.341-3.302H5.781v-.952h4.799V6.975H4.77v-.953h5.81V3.591s0-.409.411-.409h2.347v2.84h5.744v.951h-5.744v1.704h4.69a19.453 19.453 0 0 1-1.986 5.06c1.424.52 2.702 1.011 3.654 1.333m-13.81-2.032c-.596.06-1.71.325-2.321.869-1.83 1.608-.735 4.55 2.968 4.55 2.151 0 4.301-1.388 5.99-3.61-2.403-1.182-4.438-2.028-6.637-1.809'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.695 15.07c3.426 1.158 4.203 1.22 4.203 1.22V3.846c0-2.124-1.705-3.845-3.81-3.845H3.914C1.808.001.102 1.722.102 3.846v16.31c0 2.123 1.706 3.845 3.813 3.845h16.173c2.105 0 3.81-1.722 3.81-3.845v-.157s-6.19-2.602-9.315-4.119c-2.096 2.602-4.8 4.181-7.607 4.181-4.75 0-6.361-4.19-4.112-6.949.49-.602 1.324-1.175 2.617-1.497 2.025-.502 5.247.313 8.266 1.317a16.796 16.796 0 0 0 1.341-3.302H5.781v-.952h4.799V6.975H4.77v-.953h5.81V3.591s0-.409.411-.409h2.347v2.84h5.744v.951h-5.744v1.704h4.69a19.453 19.453 0 0 1-1.986 5.06c1.424.52 2.702 1.011 3.654 1.333m-13.81-2.032c-.596.06-1.71.325-2.321.869-1.83 1.608-.735 4.55 2.968 4.55 2.151 0 4.301-1.388 5.99-3.61-2.403-1.182-4.438-2.028-6.637-1.809'/%3E%3C/svg%3E");
}

.brand-icon.bi-weixin {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z'/%3E%3C/svg%3E");
}

.brand-icon.bi-qq {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.395 15.035a40 40 0 0 0-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526 4.632 17.351 0 12 0S4.474 4.632 4.474 9.241c0 .274.013.804.014.836l-1.08 2.695a39 39 0 0 0-.802 2.264c-1.021 3.283-.69 4.643-.438 4.673.54.065 2.103-2.472 2.103-2.472 0 1.469.756 3.387 2.394 4.771-.612.188-1.363.479-1.845.835-.434.32-.379.646-.301.778.343.578 5.883.369 7.482.189 1.6.18 7.14.389 7.483-.189.078-.132.132-.458-.301-.778-.483-.356-1.233-.646-1.846-.836 1.637-1.384 2.393-3.302 2.393-4.771 0 0 1.563 2.537 2.103 2.472.251-.03.581-1.39-.438-4.673'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.395 15.035a40 40 0 0 0-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526 4.632 17.351 0 12 0S4.474 4.632 4.474 9.241c0 .274.013.804.014.836l-1.08 2.695a39 39 0 0 0-.802 2.264c-1.021 3.283-.69 4.643-.438 4.673.54.065 2.103-2.472 2.103-2.472 0 1.469.756 3.387 2.394 4.771-.612.188-1.363.479-1.845.835-.434.32-.379.646-.301.778.343.578 5.883.369 7.482.189 1.6.18 7.14.389 7.483-.189.078-.132.132-.458-.301-.778-.483-.356-1.233-.646-1.846-.836 1.637-1.384 2.393-3.302 2.393-4.771 0 0 1.563 2.537 2.103 2.472.251-.03.581-1.39-.438-4.673'/%3E%3C/svg%3E");
}

/* ---------- API 详情评论区（供 JSON 渲染与首屏共用） ---------- */
.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05)
}

.comment-item:last-child {
    border-bottom: none
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap
}

.comment-author {
    font-size: 13px;
    font-weight: 500;
    color: var(--text)
}

.comment-location {
    font-size: 11px;
    color: var(--text-muted)
}

.comment-time {
    font-size: 11px;
    color: var(--text-muted)
}

.comment-pinned {
    font-size: 10px;
    background: #fef3c7;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 3px
}

.comment-body {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-light);
    margin: 6px 0 8px 12px 0;
    word-break: break-word
}

.comment-actions {
    display: flex;
    gap: 12px;
    margin-left: 0
}

.comment-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    font-family: inherit
}

.comment-action-btn:hover {
    color: var(--c-primary)
}

.comment-action-btn.liked {
    color: var(--danger)
}

.comment-replies {
    margin-left: 32px;
    padding-left: 12px;
    border-left: 2px solid rgba(var(--c-primary-rgb), 0.15)
}

.comment-reply-item {
    padding: 8px 0
}

.comment-reply-item+.comment-reply-item {
    border-top: 1px solid rgba(0, 0, 0, 0.03)
}

.comment-reply-to {
    font-size: 12px;
    color: var(--c-primary);
    margin-right: 4px
}

.comment-form-box {
    display: flex;
    gap: 10px;
    align-items: flex-start
}

.comment-form-input {
    flex: 1
}

.comment-form-input textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    font-family: inherit;
    transition: var(--transition)
}

.comment-form-input textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(var(--c-primary-rgb), 0.15)
}

.comment-nickname-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px
}

.comment-nickname-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit
}

.comment-nickname-row input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(var(--c-primary-rgb), 0.15)
}

.comment-submit-btn {
    align-self: flex-end
}

.comment-page-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-light);
    font-family: inherit;
    transition: var(--transition)
}

.comment-page-btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary)
}

.comment-page-btn.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary)
}

.comment-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed
}

.comment-captcha-area {
    margin: 8px 0
}

/* ---------- API 详情：折叠区 / 参数详情（JSON 渲染与首屏共用） ---------- */
.collapse-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.collapse-header:hover {
    color: var(--c-primary)
}

.collapse-arrow {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    transition: all 0.2s
}

.collapse-header:hover .collapse-arrow {
    background: rgba(var(--c-primary-rgb), 0.1);
    color: var(--c-primary)
}

.collapse-arrow i {
    transition: transform 0.2s;
    font-size: 12px
}

.card.expanded .collapse-content {
    display: block !important
}

.card.expanded .collapse-arrow i {
    transform: rotate(180deg)
}

.card.expanded .collapse-hint {
    display: none
}

.param-item {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.2s
}

.param-item.has-detail {
    cursor: pointer
}

.param-item.has-detail:hover {
    background: rgba(139, 92, 246, 0.05)
}

.param-item.expanded {
    background: rgba(139, 92, 246, 0.08)
}

.param-item.expanded .param-arrow {
    transform: rotate(90deg)
}

.param-detail-wrapper {
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06)
}

.param-detail-sandbox {
    all: initial;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: #333
}

.param-detail-sandbox * {
    box-sizing: border-box
}

.code-content[data-placeholder] {
    min-height: 0 !important;
    padding: 14px !important;
    white-space: normal !important;
    resize: none !important
}

.code-content[data-placeholder] .btn {
    font-size: 12px;
    padding: 4px 10px
}

.brand-icon.bi-markdown {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z'/%3E%3C/svg%3E");
}
