/* --------------------------------------------------------------------------
   7.3 Thoughts - 想法系统
   -------------------------------------------------------------------------- */

/* ==================== 想法系统样式 ==================== */

/* @提及链接样式 */
.uap-mention {
    color: var(--uap-action-bg, #4f46e5);
    text-decoration: none;
    font-weight: 500;
}

.uap-mention:hover {
    text-decoration: underline;
}

/* @提及自动补全下拉框 */
.uap-mention-dropdown {
    position: absolute;
    z-index: 1000;
    min-width: 240px;
    max-width: 320px;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--uap-border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
}

.uap-mention-dropdown.active {
    display: block;
}

.uap-mention-dropdown-header {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--uap-text-light, #6b7280);
    border-bottom: 1px solid var(--uap-border, #e5e7eb);
}

.uap-mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.uap-mention-item:hover,
.uap-mention-item.active {
    background: #f3f4f6;
}

.uap-mention-item-avatar {
    flex-shrink: 0;
}

.uap-mention-item-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.uap-mention-item-info {
    flex: 1;
    min-width: 0;
}

.uap-mention-item-name {
    font-weight: 500;
    color: var(--uap-text, #374151);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uap-mention-item-username {
    font-size: 12px;
    color: var(--uap-text-light, #6b7280);
}

.uap-mention-empty {
    padding: 20px 14px;
    text-align: center;
    color: var(--uap-text-light, #6b7280);
    font-size: 13px;
}

.uap-mention-loading {
    padding: 20px 14px;
    text-align: center;
    color: var(--uap-text-light, #6b7280);
    font-size: 13px;
}

/* 仅供读屏：操作按钮只显示图标和数字，名称保留给辅助技术 */
.uap-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 想法系统全局样式重置 */
.uap-thought-stream a,
.uap-thought-card a,
.uap-thought-stream-page a {
    text-decoration: none;
}

/* 内容操作栏（UAP_Action_Bar）的颜色令牌：每种操作只声明自己的强调色，
   静止、悬停、选中、菜单展开共用同一套规则。 */
.uap-thought-action {
    --uap-action-color: var(--uap-text-muted);
    --uap-action-hover-color: var(--uap-text);
    --uap-action-halo: color-mix(in srgb, var(--uap-action-hover-color) 12%, transparent);
}

.uap-thought-action.comment {
    --uap-action-hover-color: var(--uap-action-bg);
}

.uap-thought-action.like {
    --uap-action-hover-color: var(--uap-error);
}

.uap-thought-action.favorite {
    --uap-action-hover-color: var(--uap-accent-strong);
}

/* 主题常给 button/a 的 :hover、:focus 加底色、下划线和阴影，这里统一兜底 */
.uap-thought-action,
.uap-thought-action:focus,
button.uap-thought-action,
button.uap-thought-action:focus,
[type=button].uap-thought-action:focus {
    background: transparent !important;
    color: var(--uap-action-color) !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

.uap-thought-action.active,
.uap-thought-action.active:focus {
    color: var(--uap-action-hover-color) !important;
}

/* 悬停反馈画在图标后的圆形光晕上（::before），按钮本身始终透明：
   按钮是固定宽度的槽位，整块铺底色在没有数字时会远大于图标。
   仅在可悬停的设备上显示，避免触屏点按后底色残留。 */
@media (hover: hover) {
    .uap-thought-action:hover,
    button.uap-thought-action:hover,
    [type=button].uap-thought-action:hover {
        background: transparent !important;
        color: var(--uap-action-hover-color) !important;
        text-decoration: none !important;
    }

    .uap-thought-action:hover::before {
        background: var(--uap-action-halo);
    }
}

.uap-thought-action.more[aria-expanded="true"] {
    color: var(--uap-action-hover-color) !important;
}

.uap-thought-action.more[aria-expanded="true"]::before {
    background: var(--uap-action-halo);
}

/* 想法流容器 */
.uap-thought-stream {
    max-width: 680px;
    margin: 0 auto;
}

/* 想法流全屏页（thought-stream-template.php）：单栏 / 双栏 */
.uap-thought-stream-page {
    min-height: calc(100vh - 200px);
    background: var(--uap-bg);
    padding: 28px 20px;
}

.uap-thought-stream-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

.uap-thought-stream-page.has-sidebar .uap-thought-stream-wrapper {
    display: flex;
    gap: 24px;
    max-width: 1000px;
}

.uap-thought-stream-page.has-sidebar .uap-thought-stream-main {
    flex: 1;
    min-width: 0;
    max-width: 680px;
}

.uap-thought-stream-page.has-sidebar .uap-thought-stream-aside {
    width: 280px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .uap-thought-stream-page.has-sidebar .uap-thought-stream-wrapper {
        max-width: 680px;
    }

    .uap-thought-stream-page.has-sidebar .uap-thought-stream-aside {
        display: none;
    }
}

@media (max-width: 768px) {
    .uap-thought-stream-page {
        padding: 12px 8px;
    }
}

.uap-thought-stream-form {
    margin-bottom: 16px;
}

/* 想法筛选栏：与下方列表合成一张卡（筛选栏是卡片顶部），滚动时吸顶。
   吸顶位置避开 WordPress 管理工具栏；主题有固定页头时可设置 --uap-sticky-top。 */
.uap-thought-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--uap-surface);
    border-radius: var(--uap-radius-md) var(--uap-radius-md) 0 0;
    margin-bottom: 0;
    box-shadow: none;
    position: sticky;
    top: var(--uap-sticky-top, 0px);
    z-index: 100;
    border: 1px solid var(--uap-border);
    border-bottom-color: var(--uap-border-light);
    padding-right: 8px;
}

body.admin-bar .uap-thought-filters {
    top: calc(32px + var(--uap-sticky-top, 0px));
}

@media (max-width: 782px) {
    body.admin-bar .uap-thought-filters {
        top: calc(46px + var(--uap-sticky-top, 0px));
    }
}

/* 窄屏时 WordPress 工具栏随页面滚走，不再占位 */
@media (max-width: 600px) {
    body.admin-bar .uap-thought-filters {
        top: var(--uap-sticky-top, 0px);
    }
}

/* 列表是同一张卡的下半部分 */
.uap-thought-filters ~ .uap-thought-stream-list {
    border-top: 0;
    border-radius: 0 0 var(--uap-radius-md) var(--uap-radius-md);
}

.uap-thought-filter-tabs-shell {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    overflow: hidden;
    border-radius: var(--uap-radius-md) 0 0 0;
}

.uap-thought-filter-tabs {
    width: 100%;
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;
    min-width: 0;
    scroll-behavior: smooth;
    scroll-padding-inline: 20px;
    overscroll-behavior-inline: contain;
}

.uap-thought-filter-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
}

/* 根据真实溢出状态显示左右渐变，不依赖语言或视口断点。 */
.uap-thought-filter-tabs-shell::before,
.uap-thought-filter-tabs-shell::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 24px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.uap-thought-filter-tabs-shell::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

.uap-thought-filter-tabs-shell::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

.uap-thought-filter-tabs-shell.has-hidden-left::before,
.uap-thought-filter-tabs-shell.has-hidden-right::after {
    opacity: 1;
}

/* 滑动指示器 */
.uap-filter-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--uap-action-bg);
    border-radius: 2px 2px 0 0;
    transition: left var(--uap-duration, 200ms) var(--uap-ease-out, ease), width var(--uap-duration, 200ms) var(--uap-ease-out, ease);
    pointer-events: none;
    box-shadow: none;
    z-index: 1;
}

/* 标签只用文字：窄屏也显示文字，放不下时横向滑动，比五个无标注图标更好辨认 */
.uap-thought-filter-tabs .uap-filter-tab {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 14px 14px;
    border: none;
    background: transparent;
    color: var(--uap-text-light);
    font-size: var(--uap-text-base);
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color var(--uap-duration-fast, 120ms) ease;
    white-space: nowrap;
    outline: none;
    scroll-margin-inline: 8px;
}

.uap-thought-filter-tabs .uap-filter-tab:hover {
    color: var(--uap-text);
    background: transparent !important;
}

.uap-thought-filter-tabs .uap-filter-tab:focus {
    color: var(--uap-text) !important;
    background: transparent !important;
    outline: none;
}

.uap-thought-filter-tabs .uap-filter-tab.active {
    color: var(--uap-text);
    font-weight: 600;
}

.uap-thought-filter-tabs .uap-filter-tab.active:hover {
    background: transparent !important;
}

.uap-thought-filter-tabs .uap-filter-tab.active:focus {
    color: var(--uap-text) !important;
    background: transparent !important;
}

.uap-thought-filter-tabs .uap-filter-icon {
    display: none;
}

.uap-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.uap-thought-filter-tabs .uap-filter-tab:focus-visible {
    box-shadow: inset 0 0 0 2px var(--uap-action-bg);
    border-radius: var(--uap-radius-sm);
}

.uap-filter-icon svg {
    width: 16px;
    height: 16px;
}

.uap-filter-text {
    display: inline;
}

/* 搜索按钮（筛选栏内） */
.uap-thought-filters .uap-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--uap-radius);
    color: var(--uap-text-light);
    cursor: pointer;
    transition: var(--uap-transition);
    flex-shrink: 0;
    padding: 0;
}

.uap-thought-filters .uap-search-toggle svg {
    width: 20px;
    height: 20px;
}

.uap-thought-filters .uap-search-toggle:hover {
    background: var(--uap-surface-hover);
    color: var(--uap-text);
}

.uap-thought-filters .uap-search-toggle.active {
    color: var(--uap-action-bg);
    background: var(--uap-primary-bg);
}

/* 搜索栏（筛选栏下方，展开/收起）：位于同一张卡内，两侧延续卡片边框 */
.uap-thought-stream .uap-thought-search-bar {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0;
    padding: 0 12px;
    background: var(--uap-surface);
    border-inline: 1px solid var(--uap-border);
    transition: max-height var(--uap-duration, 200ms) var(--uap-ease-out, ease),
        opacity var(--uap-duration, 200ms) ease,
        padding var(--uap-duration, 200ms) var(--uap-ease-out, ease);
}

.uap-thought-stream .uap-thought-search-bar.open {
    max-height: 72px;
    opacity: 1;
    padding: 12px;
    border-bottom: 1px solid var(--uap-border-light);
}

.uap-thought-search-bar .uap-search-bar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--uap-surface);
    border: 1px solid var(--uap-border);
    border-radius: var(--uap-radius-md);
    padding: 10px 16px;
    transition: border-color 0.15s ease;
}

.uap-thought-search-bar .uap-search-bar-inner:hover {
    border-color: var(--uap-border-hover);
}

.uap-thought-search-bar .uap-search-bar-inner:focus-within {
    border-color: var(--uap-action-bg);
}

.uap-thought-search-bar .uap-search-bar-icon {
    flex-shrink: 0;
    color: var(--uap-text-light);
    transition: color 0.2s ease;
}

.uap-thought-search-bar .uap-search-bar-inner:focus-within .uap-search-bar-icon {
    color: var(--uap-action-bg, #4f46e5);
}

.uap-thought-search-bar .uap-search-bar-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--uap-text);
    min-width: 0;
    padding: 0;
    margin: 0;
    line-height: 2;
    box-shadow: none;
    height: auto;
}

.uap-thought-search-bar .uap-search-bar-input:focus {
    border: none;
    outline: none;
    box-shadow: none;
}

.uap-thought-search-bar .uap-search-bar-input::placeholder {
    color: var(--uap-text-light);
}

.uap-thought-search-bar .uap-search-bar-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--uap-surface-hover);
    border-radius: 50%;
    color: var(--uap-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: var(--uap-transition);
}

.uap-thought-search-bar .uap-search-bar-clear:hover {
    background: var(--uap-text-light);
    color: #fff;
}

/* 排序选择器 */
.uap-thought-sort {
    position: relative;
    flex-shrink: 0;
}

.uap-sort-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent !important;
    border: 1px solid var(--uap-border) !important;
    border-radius: var(--uap-radius-sm);
    color: var(--uap-text-muted) !important;
    font-size: var(--uap-text-base);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    outline: none !important;
    min-height: 36px;
    /* 确保触摸目标足够大 */
}

.uap-sort-trigger:hover,
.uap-sort-trigger:focus {
    background: var(--uap-surface-hover) !important;
    border-color: var(--uap-border-hover) !important;
    color: var(--uap-text) !important;
    box-shadow: none !important;
}

.uap-sort-trigger:focus-visible {
    box-shadow: 0 0 0 2px var(--uap-action-bg) !important;
}

.uap-sort-trigger:active {
    transform: scale(0.98);
}

.uap-sort-trigger svg {
    flex-shrink: 0;
}

.uap-sort-text {
    line-height: 1;
}

.uap-sort-arrow {
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.uap-thought-sort.open .uap-sort-arrow {
    transform: rotate(180deg);
}

.uap-sort-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    background: var(--uap-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--uap-border);
    border-radius: var(--uap-radius-md);
    box-shadow: var(--uap-shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 200;
}

.uap-thought-sort.open .uap-sort-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.uap-sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--uap-radius-sm);
    color: var(--uap-text);
    font-size: var(--uap-text-base);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.uap-sort-option:hover {
    background: var(--uap-surface-hover);
    color: var(--uap-text);
}

.uap-sort-option.active {
    background: var(--uap-primary-bg);
    color: var(--uap-action-bg);
}

.uap-sort-option svg {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.uap-sort-option.active svg {
    opacity: 1;
}

.uap-sort-option span {
    flex: 1;
}

/* 想法空状态 */
.uap-thoughts-empty {
    padding: 80px 20px;
    text-align: center;
    background: transparent;
    border-radius: var(--uap-radius-xl);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.uap-empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--uap-text-muted);
    opacity: 0.4;
}

.uap-empty-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--uap-text);
    margin-bottom: 8px;
}

.uap-empty-hint {
    font-size: 14px;
    color: var(--uap-text-light);
}

.uap-thoughts-load-error .uap-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.uap-thoughts-load-error .uap-empty-icon svg {
    width: 40px;
    height: 40px;
}

.uap-thoughts-load-error .uap-thought-retry-btn {
    margin-top: 18px;
}

/* 信息流：列表容器承载卡片感，条目之间只留发丝分隔线 */
.uap-thought-stream-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--uap-surface);
    border: 1px solid var(--uap-border);
    border-radius: var(--uap-radius-md);
    box-shadow: none;
    overflow: hidden;
    min-height: 400px;
    position: relative;
    transition: opacity 0.3s ease;
}

/* 加载状态 */
.uap-thought-stream-list .uap-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--uap-text-muted);
    background: transparent;
    font-size: var(--uap-text-base);
}

/* 骨架屏：与信息流条目同样的行结构 */
.uap-skeleton-loading {
    background: transparent;
    padding: 0;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.uap-skeleton-item {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: 0;
    border-bottom: 1px solid var(--uap-border-light);
    position: relative;
    overflow: hidden;
}

.uap-skeleton-item::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.6) 50%,
            transparent 100%);
    animation: uap-skeleton-shimmer 1.6s infinite ease-in-out;
    pointer-events: none;
}

.uap-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--uap-surface-hover);
    flex-shrink: 0;
}

.uap-skeleton-content {
    flex: 1;
    min-width: 0;
}

.uap-skeleton-line {
    height: 12px;
    background: var(--uap-surface-hover);
    border-radius: 6px;
    margin-bottom: 12px;
}

.uap-skeleton-line:last-child {
    margin-bottom: 0;
}

.uap-skeleton-line.short {
    width: 60%;
}

.uap-skeleton-line.medium {
    width: 80%;
}

@keyframes uap-skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.uap-thought-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--uap-text-light, #6b7280);
    background: #fff;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .uap-thought-filters {
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 0;
        padding: 0 4px 0 0;
        gap: 4px;
    }

    .uap-thought-filter-tabs {
        gap: 0;
        padding: 0;
        border-radius: 0;
    }

    .uap-thought-filter-tabs-shell {
        border-radius: 0;
    }

    .uap-thought-filter-tabs .uap-filter-tab {
        padding: 13px 12px;
        font-size: 14px;
        min-width: 44px;
        justify-content: center;
        flex-shrink: 0;
    }

    .uap-filter-icon svg {
        width: 20px;
        /* 恢复到20px，更清晰 */
        height: 20px;
    }

    /* 滑动指示器移动端优化 */
    .uap-filter-indicator {
        height: 2px;
    }

    /* 排序选择器移动端样式 - 只显示图标 */
    .uap-thought-sort {
        flex-shrink: 0;
    }

    .uap-sort-trigger {
        padding: 10px;
        /* 增加内边距 */
        min-width: 40px;
        min-height: 40px;
        border-radius: 8px;
        gap: 0;
        border: unset !important;
    }

    .uap-sort-trigger svg:first-child {
        width: 20px;
        /* 与筛选图标一致 */
        height: 20px;
    }

    /* 移动端隐藏排序文字和箭头 */
    .uap-sort-text {
        display: none;
    }

    .uap-sort-arrow {
        display: none;
    }

    /* 下拉菜单移动端优化 */
    .uap-sort-dropdown {
        right: 0;
        min-width: 120px;
    }

    .uap-thoughts-empty {
        padding: 60px 20px;
    }

    .uap-empty-icon {
        font-size: 40px;
    }

    .uap-empty-text {
        font-size: 16px;
    }

    .uap-empty-hint {
        font-size: 13px;
    }
}

/* 小屏幕手机优化 (iPhone SE, 小屏安卓) */
@media (max-width: 480px) {
    .uap-thought-filters {
        padding: 0 2px 0 0;
        gap: 2px;
    }

    .uap-thought-filter-tabs .uap-filter-tab {
        padding: 12px 10px;
        min-width: 40px;
    }

    .uap-filter-icon svg {
        width: 18px;
        height: 18px;
    }

    .uap-sort-trigger {
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }

    .uap-sort-trigger svg:first-child {
        width: 18px;
        height: 18px;
    }
}

/* 想法卡片：独立出现时为平整卡片；在信息流与网格流中悬停只改底色，不上浮 */
.uap-thought-card {
    background: var(--uap-surface);
    padding: 20px 22px;
    border-radius: var(--uap-radius-md);
    border: 1px solid var(--uap-border);
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    position: relative;
    top: 0;
}

.uap-thought-card:hover {
    transform: none;
    box-shadow: none;
}

.uap-thought-stream-list .uap-thought-card,
.uap-posts-grid .uap-thought-card {
    margin: 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--uap-border-light);
    border-radius: 0;
}

.uap-thought-stream-list .uap-thought-card:last-child,
.uap-posts-grid .uap-thought-card:last-child {
    border-bottom: 0;
}

.uap-thought-stream-list .uap-thought-card:hover,
.uap-posts-grid .uap-thought-card:hover {
    background: var(--uap-surface-hover);
    border-color: var(--uap-border-light);
}

/* 评论展开后评论区有自己的浅底，整行不再铺悬停色 */
.uap-thought-stream-list .uap-thought-card.is-comments-open:hover,
.uap-posts-grid .uap-thought-card.is-comments-open:hover {
    background: transparent;
}

@media (max-width: 640px) {
    .uap-thought-stream-list .uap-thought-card,
    .uap-posts-grid .uap-thought-card {
        padding: 14px 16px;
    }
}

/* 想法头部 */
.uap-thought-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.uap-thought-avatar {
    flex-shrink: 0;
}

.uap-thought-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--uap-border-subtle);
}

.uap-thought-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
    line-height: 1.4;
}

/* 昵称与时间拉开层级：昵称 15px 实字，时间 13px 浅色 */
.uap-thought-author {
    font-size: 15px;
    font-weight: 600;
    color: var(--uap-text);
    text-decoration: none;
}

.uap-thought-author:hover {
    color: var(--uap-action-bg);
    text-decoration: underline;
}

.uap-thought-username {
    color: var(--uap-text-muted);
    font-size: var(--uap-text-sm);
}

.uap-thought-dot {
    color: var(--uap-border-hover);
}

.uap-thought-time {
    color: var(--uap-text-light);
    font-size: var(--uap-text-sm);
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.uap-thought-time:hover {
    text-decoration: underline;
}

/* 更多菜单 */
.uap-thought-more {
    position: relative;
    margin-left: auto;
}

/* 旧版标记（缓存页面）中独立的更多按钮 */
.uap-thought-more-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--uap-text-muted);
    cursor: pointer;
    transition: background-color var(--uap-duration-fast, 120ms) ease, color var(--uap-duration-fast, 120ms) ease;
}

.uap-thought-more-btn:hover {
    background: var(--uap-border-subtle);
    color: var(--uap-text);
}

/* 操作栏中的更多按钮：与其他操作同高的圆形热区 */
.uap-thought-action.more {
    width: 34px;
    height: 34px;
    min-width: 0;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

/* 默认向上展开（操作栏多在卡片底部）；上方空间不足时脚本加 is-below 改为向下 */
.uap-thought-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    min-width: 160px;
    padding: 4px;
    background: var(--uap-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--uap-radius-md);
    border: 1px solid var(--uap-border);
    box-shadow: var(--uap-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity var(--uap-duration-fast, 120ms) ease, transform var(--uap-duration-fast, 120ms) ease, visibility 0s linear var(--uap-duration-fast, 120ms);
    z-index: 100;
    overflow: hidden;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.uap-thought-dropdown.is-below {
    top: 100%;
    bottom: auto;
    margin-top: 6px;
    margin-bottom: 0;
    transform: translateY(-4px);
}

/* 打开时 visibility 不参与过渡：过渡起点仍为 hidden 时脚本无法把焦点移入菜单项（减弱动效下也一样） */
.uap-thought-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-property: opacity, transform;
}

/* 菜单项：主题的 button 样式（底色、边框、阴影、大写）一律清除 */
.uap-thought-edit-btn,
.uap-thought-delete-btn,
.uap-thought-report-btn {
    --uap-menu-item-color: var(--uap-text);
    --uap-menu-item-hover-color: var(--uap-text);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 8px 12px;
    background: transparent !important;
    border: none !important;
    border-radius: var(--uap-radius-sm);
    box-shadow: none !important;
    color: var(--uap-menu-item-color) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: background-color var(--uap-duration-fast, 120ms) ease, color var(--uap-duration-fast, 120ms) ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.uap-thought-report-btn {
    --uap-menu-item-color: var(--uap-text-muted);
}

.uap-thought-delete-btn {
    --uap-menu-item-color: var(--uap-danger);
    --uap-menu-item-hover-color: var(--uap-danger-hover);
}

:is(.uap-thought-edit-btn, .uap-thought-delete-btn, .uap-thought-report-btn) svg {
    flex-shrink: 0;
    color: inherit;
    stroke: currentColor;
}

:is(.uap-thought-edit-btn, .uap-thought-delete-btn, .uap-thought-report-btn):is(:hover, :focus-visible) {
    background: var(--uap-surface-hover) !important;
    color: var(--uap-menu-item-hover-color) !important;
}

:is(.uap-thought-edit-btn, .uap-thought-delete-btn, .uap-thought-report-btn):focus {
    outline: none;
}

:is(.uap-thought-edit-btn, .uap-thought-delete-btn, .uap-thought-report-btn):focus-visible {
    outline: 2px solid var(--uap-action-bg);
    outline-offset: -2px;
}

/* 想法内容：与头像、图片同一左缘（操作栏首个图标也收回到这条线上） */
.uap-thought-content {
    padding-left: 0;
}

.uap-thought-text {
    display: block;
    color: var(--uap-text);
    font-size: 15px;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 可点击的想法文本区域 */
.uap-thought-text.linkable {
    cursor: pointer;
    transition: background-color 0.2s;
}

/* 想法中的链接样式 */
.uap-thought-link {
    color: var(--uap-action-bg);
    text-decoration: none;
    word-break: break-all;
    transition: color 0.15s ease;
    border-bottom: 1px dashed;
}

.uap-thought-link:hover {
    color: var(--uap-action-hover);
    text-decoration: none;
    border-bottom: 1px solid;
}

/* 想法 Markdown 样式 */
.uap-thought-text strong {
    font-weight: 600;
}

.uap-thought-text em {
    font-style: italic;
}

.uap-thought-text del {
    text-decoration: line-through;
    color: var(--uap-text-light);
}

.uap-thought-code {
    display: inline;
    padding: 1px 5px;
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: var(--uap-surface-hover);
    border: 1px solid var(--uap-border-light);
    border-radius: 4px;
    color: #be123c;
    word-break: break-all;
}

.uap-thought-quote {
    display: block;
    margin: 6px 0;
    padding: 0;
    border: none;
    background: none;
}

.uap-thought-quote p {
    margin: 0;
    padding: 8px 14px;
    border-left: 3px solid var(--uap-border-hover);
    color: var(--uap-text-muted);
    background: var(--uap-surface-hover);
    border-radius: 0 var(--uap-radius-xs) var(--uap-radius-xs) 0;
    font-size: var(--uap-text-base);
    line-height: 1.6;
}

.uap-thought-list {
    margin: 6px 0;
    padding-left: 20px;
    list-style: none;
}

.uap-thought-list li {
    position: relative;
    padding: 2px 0 2px 12px;
    color: var(--uap-text, #374151);
    line-height: 1.6;
}

.uap-thought-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 5px;
    height: 5px;
    background: #9ca3af;
    border-radius: 50%;
}

.uap-thought-tag {
    color: var(--uap-action-bg, #4f46e5);
    text-decoration: none;
}

.uap-thought-tag:hover {
    text-decoration: underline;
}

/* 话题链接样式 */
.uap-topic-link {
    color: var(--uap-action-bg, #4f46e5);
    text-decoration: none;
    font-weight: 500;
}

.uap-topic-link:hover {
    text-decoration: underline;
}

/* 话题自动补全下拉框 */
.uap-topic-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    background: var(--uap-surface);
    border: 1px solid var(--uap-border);
    border-radius: var(--uap-radius-md);
    box-shadow: var(--uap-shadow-lg);
    overflow: hidden;
    z-index: 1000;
    display: none;
}

.uap-topic-dropdown.active {
    display: block;
}

.uap-topic-dropdown-header {
    padding: 10px 14px;
    font-size: 12px;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.uap-topic-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.uap-topic-item:hover,
.uap-topic-item.active {
    background: #f3f4f6;
}

.uap-topic-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    flex-shrink: 0;
    color: #6b7280;
}

.uap-topic-item-icon svg {
    stroke: currentColor;
}

.uap-topic-create-icon {
    background: #fff;
    border-color: #d1fae5;
    color: #059669;
}

.uap-topic-item-info {
    flex: 1;
    min-width: 0;
}

.uap-topic-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uap-topic-item-count {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.uap-topic-loading,
.uap-topic-empty {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* 热门话题组件 */
.uap-hot-topics-widget {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.uap-hot-topics-title {
    padding: 16px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #f0f0f0;
}

.uap-hot-topics-list {
    padding: 8px 0;
}

.uap-hot-topic-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.15s;
}

.uap-hot-topic-item:hover {
    background: #f9fafb;
}

.uap-hot-topic-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    border-radius: 6px;
    flex-shrink: 0;
}

.uap-hot-topic-item:nth-child(1) .uap-hot-topic-rank,
.uap-hot-topic-item:nth-child(2) .uap-hot-topic-rank,
.uap-hot-topic-item:nth-child(3) .uap-hot-topic-rank {
    background: var(--uap-action-bg, #4f46e5);
    color: #fff;
}

.uap-hot-topic-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uap-hot-topic-count {
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.uap-video-format-hint {
    margin: 8px 0 0;
    color: var(--uap-text-muted, #64748b);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* 想法视频
 *
 * 去黑边原理：容器用视频真实宽高比（--uap-video-ar，由服务端按附件元数据输出，
 * 缺失时由 frontend.js 在 loadedmetadata 时补齐）撑开，并把宽度上限换算为
 * 「高度上限 × 宽高比」。这样竖屏视频靠收窄宽度来满足高度限制，而不是像旧实现
 * 那样保持满宽再用 max-height 截断高度 —— 后者会让 object-fit 在两侧留下黑边。
 */
.uap-thought-video,
.uap-thought-single-video {
    --uap-video-ar: 1.7778;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    aspect-ratio: var(--uap-video-ar);
    max-width: min(100%, calc(var(--uap-video-max-h) * var(--uap-video-ar)));
    max-height: var(--uap-video-max-h);
}

.uap-thought-video {
    --uap-video-max-h: min(460px, 68vh);
    margin-top: 12px;
}

.uap-thought-single-video {
    --uap-video-max-h: min(560px, 76vh);
    margin-top: 16px;
}

.uap-thought-video video,
.uap-thought-single-video video {
    display: block;
    width: 100%;
    height: 100%;
    /* 容器已经是视频比例，contain 既不裁剪画面也不会产生可见黑边；
       仅对超出 [0.5, 2.4] 被收敛的极端比例保留极窄留白。 */
    object-fit: contain;
    background: #000;
}

/* 不支持 aspect-ratio 的旧浏览器退回到原有的高度截断方案 */
@supports not (aspect-ratio: 1) {
    .uap-thought-video,
    .uap-thought-single-video {
        max-width: 100%;
    }

    .uap-thought-video video {
        max-height: 400px;
    }

    .uap-thought-single-video video {
        max-height: 500px;
    }
}

/* 想法图片 */
.uap-thought-images {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
}

.uap-thought-images-1 {
    grid-template-columns: 1fr;
    max-width: 400px;
}

.uap-thought-images-2 {
    grid-template-columns: repeat(2, 1fr);
}

.uap-thought-images-3 {
    grid-template-columns: repeat(3, 1fr);
}

.uap-thought-images-4 {
    grid-template-columns: repeat(2, 1fr);
}

.uap-thought-images-5,
.uap-thought-images-6 {
    grid-template-columns: repeat(3, 1fr);
}

.uap-thought-images-7,
.uap-thought-images-8,
.uap-thought-images-9 {
    grid-template-columns: repeat(3, 1fr);
}

.uap-thought-image {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--uap-surface-hover);
}

.uap-thought-images-1 .uap-thought-image {
    aspect-ratio: 16/9;
}

.uap-thought-images-2 .uap-thought-image {
    aspect-ratio: 1;
}

.uap-thought-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.15s ease;
}

.uap-thought-image:hover img {
    opacity: 0.92;
}

/* 内容操作栏（想法卡片、想法详情、文章卡片共用）：图标 + 数字。
   每个操作占固定宽度，常见的紧凑数字（如 1.2K）出现或变化都不推动相邻按钮；“更多”靠右。
   首个操作向左收回按钮内边距，图标与头像、正文、图片同一左缘。
   --uap-action-inset 是按钮高度里图标上下的留白，卡片据此按图标而不是按钮外框计算间距。 */
.uap-action-bar,
.uap-thought-actions,
.uap-post-card-actions,
.uap-thought-single-actions {
    --uap-action-inset: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding-left: 0;
    position: relative;
}

/* 卡片垂直节奏：正文或媒体到图标 12px；图标到卡片底边等于卡片上内边距 */
:is(.uap-thought-actions, .uap-post-card-actions):not(.uap-thought-single-actions) {
    margin-top: calc(12px - var(--uap-action-inset));
    margin-bottom: calc(-1 * var(--uap-action-inset));
}

:is(.uap-action-bar, .uap-thought-actions, .uap-post-card-actions, .uap-thought-single-actions) > .uap-thought-action:first-child {
    margin-left: calc(-1 * var(--uap-action-pad-x));
}

.uap-thought-action {
    --uap-action-pad-x: 10px;
    --uap-action-icon-size: 18px;
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px var(--uap-action-pad-x);
    margin: 0;
    border-radius: 999px;
    background: transparent;
    border: none;
    color: var(--uap-action-color);
    font-size: var(--uap-text-sm);
    font-weight: 500;
    line-height: 1;
    font-feature-settings: "tnum";
    cursor: pointer;
    transition: color var(--uap-duration-fast, 120ms) ease, background-color var(--uap-duration-fast, 120ms) ease, transform var(--uap-duration-fast, 120ms) ease;
    text-decoration: none;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:is(.uap-action-bar, .uap-thought-actions, .uap-post-card-actions, .uap-thought-single-actions) > .uap-thought-action {
    min-width: 72px;
}

/* 触屏设备把热区加高到 40px，宽度保持不变 */
@media (pointer: coarse) {
    :is(.uap-action-bar, .uap-thought-actions, .uap-post-card-actions, .uap-thought-single-actions) {
        --uap-action-inset: 11px;
    }

    .uap-thought-action {
        min-height: 40px;
    }

    .uap-thought-action.more {
        width: 40px;
        height: 40px;
    }
}

/* 图标光晕：以图标中心为圆心，大小与按钮高度一致；有无数字都只包住图标 */
.uap-thought-action::before {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(var(--uap-action-pad-x) + var(--uap-action-icon-size) / 2);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    transform: translate(-50%, -50%);
    transition: background-color var(--uap-duration-fast, 120ms) ease;
    pointer-events: none;
    z-index: -1;
}

.uap-thought-action.more::before {
    left: 50%;
}

.uap-thought-action.is-pending {
    cursor: progress;
}

.uap-thought-action svg {
    width: var(--uap-action-icon-size);
    height: var(--uap-action-icon-size);
    flex-shrink: 0;
    transition: transform var(--uap-duration-fast, 120ms) ease;
}

.uap-thought-action .uap-thought-action-text {
    display: inline-block;
    min-width: 2ch;
}

/* 按下时只收缩图标，槽位和数字保持不动 */
.uap-thought-action:active svg {
    transform: scale(0.88);
}

/* 点赞/收藏：选中时图标轻弹一次，数字按增减方向滚动（thought-card.js） */
.uap-thought-action svg.is-popping {
    animation: uap-action-pop var(--uap-duration, 200ms) var(--uap-ease-out, ease-out);
}

.uap-thought-action-text.is-rolling-up {
    animation: uap-count-roll-up var(--uap-duration, 200ms) var(--uap-ease-out, ease-out);
}

.uap-thought-action-text.is-rolling-down {
    animation: uap-count-roll-down var(--uap-duration, 200ms) var(--uap-ease-out, ease-out);
}

@keyframes uap-action-pop {
    40% {
        transform: scale(1.25);
    }
}

@keyframes uap-count-roll-up {
    from {
        transform: translateY(60%);
        opacity: 0;
    }
}

@keyframes uap-count-roll-down {
    from {
        transform: translateY(-60%);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .uap-thought-action svg.is-popping,
    .uap-thought-action-text.is-rolling-up,
    .uap-thought-action-text.is-rolling-down {
        animation: none;
    }
}

.uap-thought-action:focus {
    outline: none;
}

/* 键盘焦点环画在光晕上，与悬停形状一致；用 outline 以便高对比度模式下仍可见 */
.uap-thought-action:focus-visible {
    outline: none;
}

.uap-thought-action:focus-visible::before {
    outline: 2px solid var(--uap-action-bg);
    outline-offset: 1px;
}

/* 选中态：数字随图标着色并加粗，选中瞬间光晕向外扩散一次（thought-card.js 加 is-bursting） */
.uap-thought-action.active .uap-thought-action-text {
    font-weight: 600;
}

.uap-thought-action.is-bursting::before {
    animation: uap-action-burst 520ms var(--uap-ease-out, ease-out);
}

@keyframes uap-action-burst {
    from {
        background-color: var(--uap-action-halo);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--uap-action-hover-color) 40%, transparent);
    }

    to {
        box-shadow: 0 0 0 12px color-mix(in srgb, var(--uap-action-hover-color) 0%, transparent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .uap-thought-action.is-bursting::before {
        animation: none;
    }
}

/* 评论链接 - 确保链接可点击 */
a.uap-comment-link,
a.uap-thought-action.comment {
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

a.uap-comment-link:hover {
    color: var(--uap-action-bg) !important;
    text-decoration: none !important;
}

/* 高对比度模式下系统会去掉底色，选中态改用系统强调色 */
@media (forced-colors: active) {
    .uap-thought-action.active,
    .uap-thought-action.more[aria-expanded="true"] {
        color: Highlight !important;
    }
}

/* 加载状态 */
.uap-thought-action.loading {
    pointer-events: none;
    opacity: 0.6;
}

.uap-thought-action.loading svg {
    animation: uap-action-spin 0.8s linear infinite;
}

@keyframes uap-action-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 加载更多：支持时滚动到底自动加载（按钮隐藏，容器作为触发哨兵），
   自动加载失败或浏览器不支持时显示按钮作为手动入口。 */
.uap-thought-stream-more,
.uap-thought-stream-end {
    text-align: center;
    padding: 24px 20px;
}

.uap-thought-stream-more.is-auto {
    padding: 0;
    min-height: 1px;
}

.uap-thought-stream-more.is-auto .uap-load-more-btn {
    display: none;
}

/* 追加加载时的骨架行：接在列表末尾，只有一行，不占用首屏骨架的最小高度 */
.uap-thought-stream-list .uap-skeleton-loading.is-appending {
    min-height: 0;
}

.uap-thought-stream-list .uap-skeleton-loading.is-appending .uap-skeleton-item {
    border-top: 1px solid var(--uap-border-light);
    border-bottom: 0;
}

/* 新追加或刚发布的条目淡入，位置只移动几像素 */
.uap-thought-stream-list .uap-thought-card.is-entering {
    animation: uap-feed-item-in var(--uap-duration, 200ms) var(--uap-ease-out, ease-out);
}

@keyframes uap-feed-item-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .uap-thought-stream-list .uap-thought-card.is-entering {
        animation: none;
    }
}

.uap-load-more-btn {
    padding: 10px 28px;
    background: var(--uap-surface);
    border: 1px solid var(--uap-border);
    border-radius: var(--uap-radius-sm);
    color: var(--uap-text);
    font-size: var(--uap-text-base);
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.uap-load-more-btn:hover,
.uap-load-more-btn:focus {
    background: var(--uap-primary-bg);
    border-color: var(--uap-border-hover);
    color: var(--uap-action-bg);
    outline: none;
}

.uap-load-more-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--uap-action-bg);
}

.uap-load-more-btn:active {
    transform: scale(0.98);
}

.uap-load-more-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.uap-thought-stream-end span {
    color: var(--uap-text-light);
    font-size: var(--uap-text-sm);
}

/* 想法流响应式 */
@media (max-width: 640px) {
    .uap-thought-card {
        padding: 12px 16px;
    }

    .uap-thought-avatar img {
        width: 40px;
        height: 40px;
    }

    :is(.uap-action-bar, .uap-thought-actions, .uap-post-card-actions, .uap-thought-single-actions) {
        gap: 0;
    }

    .uap-thought-action {
        --uap-action-pad-x: 8px;
    }

    :is(.uap-action-bar, .uap-thought-actions, .uap-post-card-actions, .uap-thought-single-actions) > .uap-thought-action {
        min-width: 64px;
    }

    .uap-thought-images {
        border-radius: 12px;
    }
}

/* ==================== 想法详情页样式 ==================== */

.uap-thought-single-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
}

.uap-thought-single {
    background: var(--uap-surface);
    color: var(--uap-text);
    border-radius: var(--uap-radius-xl);
    border: 1px solid var(--uap-border-light);
    box-shadow: var(--uap-shadow-md), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    overflow: hidden;
    transition: var(--uap-transition);
}

.uap-thought-single a {
    text-decoration: none;
}

/* 想法页面统一导航栏（详情页 + 话题页） */
.uap-thought-page-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--uap-border-light);
    position: sticky;
    top: 0;
    background: var(--uap-surface-alpha, rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10;
}

.uap-thought-nav-back,
.uap-thought-nav-plaza {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--uap-text, #374151);
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
    min-width: 72px;
}

.uap-thought-nav-back:hover,
.uap-thought-nav-plaza:hover {
    background: var(--uap-surface-hover);
    color: var(--uap-action-bg, #4f46e5);
}

.uap-thought-nav-back:active,
.uap-thought-nav-plaza:active {
    transform: scale(0.95);
}

.uap-thought-nav-back svg,
.uap-thought-nav-plaza svg {
    flex-shrink: 0;
}

.uap-thought-nav-back {
    margin-left: -8px;
}

.uap-thought-nav-plaza {
    margin-right: -8px;
    justify-content: flex-end;
}

.uap-thought-page-nav-title {
    min-width: 0;
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    text-align: center;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

/* 详情页导航栏圆角适配 */
.uap-thought-single>.uap-thought-page-nav {
    border-radius: var(--uap-radius-xl) var(--uap-radius-xl) 0 0;
}

.uap-thought-single-content {
    padding: 16px 20px;
}

.uap-thought-single-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.uap-thought-single-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.uap-thought-single-author-info {
    flex: 1;
    min-width: 0;
}

.uap-thought-single-author-name {
    display: inline-block;
    font-weight: 700;
    font-size: 16px;
    color: var(--uap-text, #374151);
    text-decoration: none;
}

.uap-thought-single-author-name:hover {
    text-decoration: underline;
}

.uap-thought-single-author-username {
    color: var(--uap-text-light, #6b7280);
    font-size: 14px;
}

/* 关注按钮 */
.uap-thought-follow-btn {
    padding: 8px 20px;
    background: var(--uap-text, #374151);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.uap-thought-follow-btn:hover {
    background: var(--uap-text-dark, #1f2937);
}

.uap-thought-follow-btn.following {
    background: transparent;
    border: 1px solid var(--uap-border, #e5e7eb);
    color: var(--uap-text, #374151);
}

.uap-thought-follow-btn.following .unfollow-text {
    display: none;
}

.uap-thought-follow-btn.following:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.uap-thought-follow-btn.following:hover .follow-text {
    display: none;
}

.uap-thought-follow-btn.following:hover .unfollow-text {
    display: inline;
}

.uap-thought-follow-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.uap-thought-single-body {
    margin-bottom: 16px;
}

.uap-thought-single-text {
    font-size: 17px;
    line-height: 1.6;
    color: var(--uap-text, #374151);
    margin-bottom: 16px;
    word-wrap: break-word;
}

.uap-thought-single-images {
    display: grid;
    gap: 4px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}

.uap-thought-single-images.uap-thought-images-1 {
    grid-template-columns: 1fr;
}

.uap-thought-single-images.uap-thought-images-2,
.uap-thought-single-images.uap-thought-images-4 {
    grid-template-columns: repeat(2, 1fr);
}

.uap-thought-single-images.uap-thought-images-3 {
    grid-template-columns: repeat(3, 1fr);
}

.uap-thought-single-images.uap-thought-images-5,
.uap-thought-single-images.uap-thought-images-6,
.uap-thought-single-images.uap-thought-images-7,
.uap-thought-single-images.uap-thought-images-8,
.uap-thought-single-images.uap-thought-images-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.uap-thought-single-image {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
}

.uap-thought-single-images.uap-thought-images-1 .uap-thought-single-image {
    aspect-ratio: 16/9;
}

.uap-thought-single-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.uap-thought-single-image:hover img {
    transform: scale(1.02);
}

.uap-thought-single-time {
    color: var(--uap-text-light, #6b7280);
    font-size: 15px;
}

/* 定时中标签 */
.uap-thought-scheduled-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #10b981;
    background: #ecfdf5;
    padding: 1px 8px;
    border-radius: 4px;
    line-height: 1.5;
}

.uap-thought-single-time .uap-thought-scheduled-badge {
    font-size: 15px;
    padding: 2px 10px;
}

/* 可见范围图标（卡片上，仅作者可见） */
.uap-thought-visibility-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: auto;
}

.uap-thought-visibility-badge svg {
    width: 14px;
    height: 14px;
}

/* 可见范围图标 — 带文字标签（详情页） */
.uap-thought-visibility-badge-labeled {
    gap: 4px;
    margin-left: 0;
    font-size: 13px;
}

.uap-thought-single-time-dot {
    color: #d1d5db;
    margin: 0 2px;
}

/* 可见范围选择器 */
.uap-visibility-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.uap-visibility-btn.active,
.uap-editor-visibility-btn.active {
    background: #ecfdf5;
    border-color: #10b981;
    color: #10b981;
}

.uap-visibility-dropdown {
    display: none;
    position: absolute;
    min-width: 160px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 4px;
    z-index: 100100;
    animation: uapVisDropIn 0.15s ease;
}

.uap-visibility-dropdown.uap-vis-above {
    animation: uapVisDropInUp 0.15s ease;
}

.uap-visibility-dropdown.show {
    display: block;
}

@keyframes uapVisDropInUp {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端 — 底部 sheet */
.uap-vis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 100099;
    animation: uapVisOverlayIn 0.2s ease;
}

@keyframes uapVisOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .uap-visibility-dropdown.uap-vis-mobile {
        position: fixed;
        top: auto !important;
        bottom: 0;
        left: 0 !important;
        right: 0;
        width: 100%;
        min-width: 100%;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
        animation: uapVisSlideUp 0.25s ease;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    }

    @keyframes uapVisSlideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .uap-visibility-dropdown.uap-vis-mobile .uap-visibility-option {
        padding: 12px 14px;
        font-size: 15px;
    }
}

@keyframes uapVisDropIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.uap-visibility-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background 0.15s;
    white-space: nowrap;
}

.uap-visibility-option:hover {
    background: #f3f4f6;
}

.uap-visibility-option svg:first-child {
    flex-shrink: 0;
    color: #6b7280;
}

.uap-visibility-option.active svg:first-child {
    color: #10b981;
}

.uap-visibility-option span {
    flex: 1;
}

.uap-visibility-check {
    display: none;
    color: #10b981;
    flex-shrink: 0;
}

.uap-visibility-option.active .uap-visibility-check {
    display: block;
}

.uap-visibility-option.active {
    color: #10b981;
    font-weight: 500;
}

/* 详情页操作栏：结构与想法卡片一致，上下分隔线把它和正文、评论区隔开 */
.uap-thought-single-actions {
    padding: 8px 0;
    border-top: 1px solid var(--uap-border-light);
    border-bottom: 1px solid var(--uap-border-light);
}

.uap-thought-single-comments {
    padding: 24px 20px;
}

/* 想法卡片内所有标题/文字强制跟随卡片背景色，防止深色主题 h1-h6 全局白色覆盖 */
.uap-thought-single h1,
.uap-thought-single h2,
.uap-thought-single h3,
.uap-thought-single h4,
.uap-thought-single h5,
.uap-thought-single h6 {
    color: var(--uap-text);
}

/* ==================== 创作中心想法卡片样式 ==================== */

.uap-creation-item.uap-creation-thought {
    display: block;
    padding: 0;
    border: none;
    overflow: visible;
}

.uap-creation-item.uap-creation-thought .uap-thought-card-wrapper {
    padding: 0;
}

.uap-creation-item.uap-creation-thought .uap-thought-actions {
    overflow: visible;
}

