    /* 覆盖 markdown-body 的一些默认样式以匹配主题 */
    .markdown-body {
        font-family: inherit;
        background: transparent;
        color: var(--text);
    }
    body[data-theme="dark"] .markdown-body {
        color: var(--text);
    }
    .markdown-body p { margin-bottom: 16px; }
    .markdown-body img { max-width: 100%; border-radius: 12px; }
    :root {
      --bg: #f8fafc;
      --panel: #ffffff;
      --text: #1e293b;
      --muted: #64748b;
      --primary: #1e293b;
      --line: #e2e8f0;
    }
    body { 
        margin: 0; 
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        background: var(--bg);
        color: var(--text);
    }
    .space-container {
        width: min(1000px, calc(100% - 32px));
        margin: 40px auto;
        display: flex;
        flex-direction: column;
    }
    /* 头部横幅卡片 */
    .space-header-card {
        background: var(--panel);
        border-radius: 32px;
        border: 1px solid var(--line);
        overflow: hidden;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
        margin-bottom: 24px;
        position: relative;
        flex-shrink: 0; /* 头部不压缩 */
    }

    .space-profile-info {
        padding: 0 40px 20px;
        margin-top: -45px;
        position: relative;
        z-index: 10;
        display: flex;
        align-items: flex-end;
        gap: 20px;
    }
    .space-avatar {
        width: 100px;
        height: 100px;
        border-radius: 28px;
        border: 5px solid var(--panel);
        background: var(--panel);
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
        object-fit: cover;
    }
    .space-name-box {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
    }
    .space-name-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
    }
    .space-name {
        font-size: 26px;
        font-weight: 900;
        color: var(--text);
        letter-spacing: -0.5px;
        line-height: 1.2;
    }
    .space-name[style*="--vip-auto-color"],
    .space-name[style*="--u-color"] {
        color: #f5c542 !important;
    }
    html[data-theme="dark"] .space-name:not([style*="--vip-auto-color"]):not([style*="--u-color"]),
    body[data-theme="dark"] .space-name:not([style*="--vip-auto-color"]):not([style*="--u-color"]) {
        color: #e2e8f0 !important;
    }
    .space-tags-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .space-signature-row {
        margin-top: 4px;
        display: flex;
        align-items: flex-start;
        gap: 6px;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.6;
    }
    .space-signature-row svg {
        flex-shrink: 0;
        margin-top: 3px;
        opacity: 0.6;
    }
    .space-badges {
        display: inline-flex;
        gap: 8px;
        align-items: center;
    }
    .space-badge {
        padding: 4px 12px;
        border-radius: 10px;
        font-size: 11px;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .badge-role { border: none; }
    .role-admin {
        background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
        color: #fff;
    }
    .role-webmaster {
        background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
        position: relative;
        overflow: hidden;
        color: #fff;
        text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
    .role-webmaster::after {
        content: "";
        position: absolute;
        top: -50%; left: -50%; width: 200%; height: 200%;
        background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.2) 50%, transparent 55%);
        animation: shine 3s infinite;
    }
    .role-moderator {
        background: linear-gradient(135deg, #1e293b 0%, #1e293b 100%);
        box-shadow: 0 4px 12px rgba(30, 41, 59, 0.2);
        color: #fff;
    }
    .role-user {
        background: var(--panel);
        color: var(--muted);
        border: 1px solid var(--line);
        box-shadow: none;
    }
    .signature-wrap {
        margin-top: 12px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    .user-id-badge {
        background: var(--bg);
        border: 1px solid var(--line);
        padding: 4px 10px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 800;
        color: var(--muted);
        text-transform: uppercase;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    .signature-text {
        font-size: 14px;
        color: var(--muted);
        line-height: 1.5;
        margin: 0;
        font-style: normal;
    }

    @keyframes shine {
        0% { transform: translateX(-100%) translateY(-100%); }
        20%, 100% { transform: translateX(100%) translateY(100%); }
    }

    .space-actions {
        margin-bottom: 8px;
    }
    .btn { padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
    .btn-primary { background: var(--primary); color: #fff; }
    .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(30, 41, 59, 0.2); }
    .btn-outline { background: #fff; border: 1.5px solid var(--line); color: var(--muted); }
    .btn-outline:hover { border-color: var(--primary); color: var(--primary); }
    
    .btn-hover-swap { position: relative; overflow: hidden; display: inline-flex; justify-content: center; align-items: center; transition: all 0.2s; }
    .btn-hover-swap .normal-text { display: inline-flex; align-items: center; gap: 8px; transition: opacity 0.2s; }
    .btn-hover-swap .hover-text { position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; opacity: 0; transition: opacity 0.2s; }
    .btn-hover-swap:hover .normal-text { opacity: 0; }
    .btn-hover-swap:hover .hover-text { opacity: 1; }
    .btn-hover-swap.following-btn { background: transparent; }
    .btn-hover-swap.following-btn:hover { background: #fee2e2 !important; color: #ef4444 !important; border-color: #fca5a5 !important; }

    /* 手机签到按钮默认隐藏 */
    .mobile-checkin-btn { display: none; }

    /* 内容网格 */
    .space-grid {
        display: block;
        flex: 1;
        min-height: 0;
    }
    
    .space-main {
        padding-bottom: 40px;
    }

    .space-sidebar-widget {
        background: var(--panel);
        border-radius: 24px;
        border: 1px solid var(--line);
        padding: 24px;
        margin-bottom: 24px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    }
    .widget-title { font-size: 16px; font-weight: 800; margin-bottom: 16px; color: var(--text); display: flex; align-items: center; gap: 8px; }
    
    .stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .stat-item { text-align: center; padding: 16px; background: #f8fafc; border-radius: 16px; border: 1px solid var(--line); min-height: 80px; display: flex; flex-direction: column; justify-content: center; }
    body[data-theme="dark"] .stat-item { background: rgba(255,255,255,0.03); }
    .stat-val { font-size: 20px; font-weight: 900; color: var(--primary); display: block; }
    .stat-label { font-size: 11px; color: var(--muted); font-weight: 700; }

    /* 加入时间精美卡片 */
    .join-time-card {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .join-date-row {
        display: flex;
        align-items: center;
        gap: 12px;
        background: var(--bg);
        padding: 12px 16px;
        border-radius: 16px;
        border: 1px solid var(--line);
    }
    .join-date-icon {
        width: 40px;
        height: 40px;
        background: #fff;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: var(--primary);
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
        border: 1px solid var(--line);
        flex-shrink: 0;
    }
    body[data-theme="dark"] .join-date-icon {
        background: #1e293b;
    }
    .join-date-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .join-date-main {
        font-size: 15px;
        font-weight: 900;
        color: var(--text);
        letter-spacing: 0.5px;
    }
    .join-date-sub {
        font-size: 11px;
        color: var(--muted);
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .join-date-sub::before {
        content: "";
        width: 4px;
        height: 4px;
        background: var(--primary);
        border-radius: 50%;
        display: inline-block;
    }

    /* 动态列表 */
    .timeline-list { 
        display: flex; 
        flex-direction: column; 
        gap: 12px; 
        position: relative;
    }

    .timeline-item {
        background: var(--panel);
        border-radius: 20px;
        border: 1px solid var(--line);
        padding: 16px 20px;
        display: flex;
        align-items: flex-start;
        gap: 16px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }
    .timeline-item:hover { 
        border-color: var(--primary); 
        transform: translateY(-2px); 
        background: var(--bg);
        box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    }
    .timeline-icon {
        width: 44px; height: 44px;
        border-radius: 14px;
        background: #f1f5f9;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        flex-shrink: 0;
        border: 1px solid var(--line);
        transition: all 0.3s;
    }
    body[data-theme="dark"] .timeline-icon {
        background: #1e293b;
    }
    .timeline-item:hover .timeline-icon {
        background: var(--primary-soft);
        border-color: var(--primary);
        transform: scale(1.05) rotate(5deg);
    }
    .timeline-content { flex: 1; min-width: 0; padding-top: 2px; }
    .timeline-title { 
        font-weight: 800; 
        color: var(--text); 
        margin-bottom: 6px; 
        font-size: 15px; 
        line-height: 1.4;
    }
    .timeline-meta { 
        font-size: 12px; 
        color: var(--muted); 
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .reward-badge {
        background: #fffbeb;
        color: #d97706;
        padding: 2px 10px;
        border-radius: 100px;
        font-size: 11px;
        font-weight: 900;
        border: 1px solid #fef3c7;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    body[data-theme="dark"] .reward-badge {
        background: rgba(217, 119, 6, 0.1);
        color: #f59e0b;
        border-color: rgba(217, 119, 6, 0.2);
    }

    /* 动态名称颜色优化 */
    .timeline-task-name {
        color: #1e293b; /* 亮色模式：沉稳的靛蓝色 */
        font-weight: 800;
        margin: 0 2px;
    }
    .timeline-post-name, .timeline-target-name {
        color: var(--primary); /* 使用主题绿 */
        font-weight: 800;
        margin-left: 2px;
    }
    body[data-theme="dark"] .timeline-task-name {
        color: #a5b4fc; /* 暗色模式：更亮一点的淡靛蓝，确保对比度 */
    }

    /* 选项卡导航样式 */
    .space-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 24px;
        background: var(--panel);
        padding: 6px;
        border-radius: 16px;
        border: 1px solid var(--line);
        width: fit-content;
    }
    .space-tab-item {
        padding: 10px 20px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 800;
        color: var(--muted);
        text-decoration: none;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .space-tab-item:hover {
        background: var(--bg);
        color: var(--text);
    }
    .space-tab-item.active {
        background: var(--primary-soft);
        color: var(--primary);
    }
    .tab-count {
        font-size: 11px;
        background: var(--line);
        color: var(--muted);
        padding: 2px 8px;
        border-radius: 20px;
        font-weight: 700;
        margin-left: 4px;
        transition: all 0.2s;
    }
    .space-tab-item.active .tab-count {
        background: var(--primary);
        color: #fff;
    }

    /* 列表卡片样式增强 */
    .space-item-card {
        background: var(--panel);
        border-radius: 20px;
        border: 1px solid var(--line);
        padding: 16px 20px; /* 稍微减小上下内边距 */
        margin-bottom: 12px; /* 减小间距 */
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex; /* 改为 flex 布局 */
        align-items: center;
        justify-content: space-between;
        text-decoration: none;
        color: inherit;
        position: relative;
        overflow: hidden;
    }
    .space-item-card:hover {
        border-color: var(--primary);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    }
    .space-item-content { flex: 1; min-width: 0; }
    .space-item-arrow {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        background: var(--bg);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--muted);
        transition: all 0.3s;
        opacity: 0;
        transform: translateX(10px);
        flex-shrink: 0;
        margin-left: 16px;
        border: 1px solid var(--line);
    }
    .space-item-card:hover .space-item-arrow {
        opacity: 1;
        transform: translateX(0);
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }
    .space-item-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
    .space-item-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 12px; }
    .meta-icon-item { display: flex; align-items: center; gap: 4px; }
    .meta-icon-item svg { opacity: 0.6; }
    .space-item-excerpt { 
        font-size: 14px; 
        color: var(--muted); 
        margin-top: 10px; 
        line-height: 1.6; 
        display: -webkit-box; 
        -webkit-line-clamp: 3; /* 严格限制为3行 */
        -webkit-box-orient: vertical; 
        overflow: hidden; 
        max-height: 4.8em; /* 兜底高度限制 */
    }

    /* 手机端适配 */
    @media (max-width: 800px) {
        .space-container { margin: 0 auto; width: 100%; }
        .space-grid { padding: 0 12px; }
        .space-header-card { border-radius: 0; border: none; margin-bottom: 12px; box-shadow: none; }
        .space-banner { height: 100px; }
        
        .space-profile-info { 
            padding: 0 16px 20px; 
            flex-direction: column; 
            align-items: flex-start;
            margin-top: -40px; 
            gap: 16px;
        }
        
        .space-avatar { 
            width: 72px; 
            height: 72px; 
            border-radius: 20px; 
            border-width: 4px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.1);
            margin-bottom: 0;
        }
        
        .space-name-box { 
            width: 100%;
            min-width: 0;
            padding-bottom: 0;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            gap: 12px;
            margin-top: 0;
        }
        
        .space-name { 
            font-size: 18px; 
            margin-bottom: 0; 
            justify-content: flex-start;
            gap: 8px;
            align-items: center;
            line-height: 1;
        }
        
        .name-wrapper {
            padding: 4px 10px;
            border-radius: 10px;
            gap: 6px;
        }

        .signature-wrap {
            margin-top: 0;
            padding: 0;
            background: transparent;
            border: none;
            display: flex;
            align-items: center;
            gap: 8px;
            max-width: 100%;
        }

        .user-id-badge {
            font-size: 9px;
            padding: 1px 6px;
            flex-shrink: 0;
        }

        .signature-text {
            font-size: 11px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            opacity: 0.7;
        }

        .mobile-checkin-btn {
            display: inline-flex !important;
            padding: 4px 10px;
            font-size: 10px;
            height: 22px;
        }

        .space-actions { 
            width: 100%; 
            margin-top: 12px;
            display: flex; 
            justify-content: flex-start; 
            gap: 8px;
        }
        .space-actions div, .space-actions form {
            width: 100%;
            display: flex;
            gap: 8px;
        }
        .btn { 
            flex: 1;
            padding: 10px;
            font-size: 13px;
            justify-content: center; 
        }
        
        .space-tabs { 
            width: calc(100% - 24px); 
            margin: 0 12px 16px;
            justify-content: flex-start; 
            overflow-x: auto; 
            padding: 4px;
            -webkit-overflow-scrolling: touch;
        }
        .space-tab-item {
            padding: 8px 16px;
            font-size: 13px;
            white-space: nowrap;
            flex-shrink: 0;
        }
    }

    body[data-theme="dark"] {
        --bg: #0f172a; --panel: #1e293b; --text: #f1f5f9; --muted: #94a3b8; --line: #334155;
    }
    body[data-theme="dark"] .stat-item { background: #0f172a; }
    body[data-theme="dark"] .badge-role { background: rgba(255,255,255,0.05); }

    /* 精美 Toast 提示 */
    .晚星社区-toast-wrap {
        position: fixed;
        top: 24px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10000;
        pointer-events: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    .晚星社区-toast {
        background: #fff;
        padding: 12px 20px;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.12);
        display: flex;
        align-items: center;
        gap: 12px;
        pointer-events: auto;
        border: 1px solid var(--line);
        min-width: 240px;
        max-width: 90vw;
        position: relative;
        overflow: hidden;
        animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    @keyframes toast-in {
        from { transform: translateY(-20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
    .晚星社区-toast.is-closing {
        animation: toast-out 0.3s forwards;
    }
    @keyframes toast-out {
        to { transform: translateY(-20px); opacity: 0; }
    }
    .toast-icon { font-size: 18px; flex-shrink: 0; }
    .toast-body { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
    .toast-close {
        width: 20px; height: 20px;
        display: flex; align-items: center; justify-content: center;
        font-size: 14px; color: var(--muted);
        cursor: pointer; border-radius: 6px; transition: all 0.2s;
    }
    .toast-close:hover { background: #f1f5f9; color: #ef4444; }
    .toast-progress {
        position: absolute;
        bottom: 0; left: 0; height: 3px;
        background: var(--primary);
        width: 100%;
        transform-origin: left;
        border-radius: 0 0 16px 16px;
        -webkit-mask-image: -webkit-radial-gradient(white, black);
    }

    /* 精美确认模态框 */
    .晚星社区-modal-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 11000;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    .晚星社区-modal-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    .晚星社区-modal {
        background: var(--panel);
        width: min(400px, 90vw);
        border-radius: 24px;
        padding: 32px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.2);
        transform: scale(0.9);
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        text-align: center;
        border: 1px solid var(--line);
    }
    .晚星社区-modal-overlay.show .晚星社区-modal {
        transform: scale(1);
    }
    .modal-icon {
        width: 64px; height: 64px;
        background: #fee2e2;
        color: #ef4444;
        border-radius: 20px;
        display: flex; align-items: center; justify-content: center;
        font-size: 32px;
        margin: 0 auto 20px;
    }
    .modal-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
    .modal-desc { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 28px; }
    .modal-btns { display: flex; gap: 12px; }
    .modal-btns .btn { flex: 1; justify-content: center; padding: 12px; }
    .btn-danger { background: #ef4444; color: #fff; }
    .btn-danger:hover { background: #dc2626; transform: translateY(-2px); box-shadow: 0 8px 16px rgba(239, 68, 68, 0.2); }
    
    /* 按钮悬浮效果增强 */
    .btn-outline-home:hover {
        border-color: var(--primary) !important;
        color: var(--primary) !important;
        background: #fff !important;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
    body[data-theme="dark"] .btn-outline-home:hover {
        background: #1e293b !important;
    }
  </style>

        .stat-item.liked .stat-icon svg {
            fill: var(--primary);
        }
        .stat-item.liked:hover {
            background: var(--primary-a1);
        }
        .stat-item.liked:hover .stat-icon {
            color: var(--primary);
        }

            .medal-group {
              background: var(--panel);
              border-radius: 24px;
              border: 1px solid var(--line);
              padding: 24px;
              margin-bottom: 24px;
              box-shadow: 0 4px 12px rgba(0,0,0,0.02);
            }
            .medal-group-title {
              font-size: 16px;
              font-weight: 800;
              color: var(--text);
              margin-bottom: 20px;
              display: flex;
              align-items: center;
              gap: 8px;
            }
            .medal-group-title::before {
              content: "";
              display: block;
              width: 4px;
              height: 16px;
              background: var(--primary);
              border-radius: 2px;
            }
            .medal-grid {
              display: grid;
              grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
              gap: 16px;
            }
            .medal-card {
              display: flex;
              align-items: center;
              gap: 12px;
              padding: 16px;
              border-radius: 16px;
              border: 1px solid var(--line);
              background: var(--bg);
              transition: all 0.3s;
              position: relative;
            }
            .medal-card.unlocked {
              border-color: var(--primary-soft);
              background: var(--panel);
              box-shadow: 0 8px 20px rgba(0,0,0,0.04);
            }
            .medal-card.unlocked:hover {
              transform: translateY(-2px);
              border-color: var(--primary);
            }
            .medal-card.locked {
              opacity: 0.6;
              filter: grayscale(1);
            }
            .medal-icon-wrap {
              width: 48px;
              height: 48px;
              border-radius: 14px;
              display: flex;
              align-items: center;
              justify-content: center;
              font-size: 24px;
              flex-shrink: 0;
              background: #e2e8f0;
              color: #94a3b8;
            }
            body[data-theme="dark"] .medal-card.locked .medal-icon-wrap {
              background: #1e293b;
              color: #475569;
            }
            .medal-info {
              flex: 1;
              min-width: 0;
            }
            .medal-name {
              font-size: 14px;
              font-weight: 900;
              color: var(--text);
              margin-bottom: 4px;
            }
            .medal-desc {
              font-size: 11px;
              color: var(--muted);
              line-height: 1.4;
            }
            .medal-equip-btn {
              position: absolute;
              top: 12px;
              right: 12px;
              padding: 4px 10px;
              border-radius: 6px;
              font-size: 11px;
              font-weight: 700;
              cursor: pointer;
              border: none;
              background: var(--primary);
              color: #fff;
              transition: all 0.2s;
              flex-shrink: 0;
            }
            .medal-equip-btn.equipped {
              background: var(--line);
              color: var(--muted);
            }
            .medal-equip-btn:hover {
              opacity: 0.9;
              transform: scale(1.05);
            }
