* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    color: #2c3e50;
    line-height: 1.6;
}

.fragments-container {
    width: 100%;
    max-width: 900px;
    padding: 40px 20px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.fragments-header {
    margin-bottom: 40px;
    /* 移除动画，立即显示 */
}

.back-link {
    margin-bottom: 20px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: #666;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #2c3e50;
    border-color: #2c3e50;
    transform: translateX(-3px);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    gap: 20px;
}

.header-left h1 {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.subtitle {
    font-size: 14px;
    color: #666;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #2c3e50;
}

.btn:hover {
    border-color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
}

.btn-primary {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.btn-primary:hover {
    background: #1a252f;
    border-color: #1a252f;
}

.btn-secondary {
    background: white;
    color: #666;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.fragments-content {
    flex: 1;
    /* 移除动画，立即显示 */
}

/* 筛选栏 */
.filter-bar {
    margin-bottom: 30px;
    display: flex;
    gap: 16px;
    flex-direction: column;
}

.search-box {
    width: 100%;
}

.search-box input {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.search-box input:focus {
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.05);
}

.tag-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 6px 16px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.tag-btn:hover {
    border-color: #2c3e50;
    color: #2c3e50;
    background: #ffffff;
}

.tag-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* 文章列表 */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.article-card {
    padding: 24px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

/* 优化：限制动画延迟，只对前8个元素添加 */
.article-card:nth-child(1) { animation-delay: 0.05s; }
.article-card:nth-child(2) { animation-delay: 0.1s; }
.article-card:nth-child(3) { animation-delay: 0.15s; }
.article-card:nth-child(4) { animation-delay: 0.2s; }
.article-card:nth-child(5) { animation-delay: 0.25s; }
.article-card:nth-child(6) { animation-delay: 0.3s; }
.article-card:nth-child(7) { animation-delay: 0.35s; }
.article-card:nth-child(8) { animation-delay: 0.4s; }
.article-card:nth-child(n+9) { animation-delay: 0.4s; } /* 第9个及以后统一延迟 */

.article-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #2c3e50;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.article-card:hover {
    border-color: #2c3e50;
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.08);
}

.article-card:hover::before {
    transform: scaleY(1);
}

.article-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #1a1a1a;
    line-height: 1.4;
}

.article-excerpt {
    font-size: 15px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 16px;
    border-left: 3px solid #f0f0f0;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
    flex-wrap: wrap;
    gap: 12px;
}

.article-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.article-tag {
    background: #f8f9fa;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    border: 1px solid #e9ecef;
}

/* 加载和空状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 15px;
}
/* 骨架屏样式 */
.skeleton-card {
    padding: 24px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    display: block;
    height: 24px;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-card::after {
    content: '';
    display: block;
    height: 60px;
    width: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
.empty-state {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.6s ease;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 300;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.empty-state p {
    color: #999;
    margin-bottom: 24px;
    font-size: 14px;
}

/* 弹窗（优化：硬件加速 + 初始隐藏） */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    
    /* 使用visibility和opacity控制显示 */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.modal.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease, visibility 0s linear;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* 移除旧的动画定义，使用transition替代 */

.modal-header {
    padding: 28px 32px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-header h2 {
    font-size: 26px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0;
    padding-right: 40px;
    line-height: 1.4;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-meta {
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-time {
    font-size: 13px;
    color: #999;
}

.meta-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-tag {
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    border: 1px solid #e9ecef;
}

.modal-body {
    padding: 32px;
}

.markdown-body {
    line-height: 1.8;
    color: #333;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a1a;
}

.markdown-body h1 {
    font-size: 28px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.markdown-body h2 {
    font-size: 24px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 6px;
}

.markdown-body h3 {
    font-size: 20px;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #e83e8c;
}

.markdown-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 28px;
}

.markdown-body li {
    margin-bottom: 8px;
}

.markdown-body blockquote {
    border-left: 4px solid #667eea;
    padding-left: 16px;
    margin: 16px 0;
    color: #666;
    font-style: italic;
}

.markdown-body a {
    color: #667eea;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body strong {
    font-weight: 600;
    color: #1a1a1a;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f8f9fa;
}

/* 登录表单 */
.login-form {
    padding: 10px 0;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.login-form input:focus {
    outline: none;
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.05);
}

.login-error {
    padding: 10px 14px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c33;
    font-size: 13px;
    margin-top: 12px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    background: #2c3e50;
    color: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 1001;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .fragments-container {
        padding: 20px 15px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-left h1 {
        font-size: 32px;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .filter-bar {
        flex-direction: column;
    }

    .search-box input {
        max-width: 100%;
    }

    .article-card {
        padding: 20px;
    }

    .article-title {
        font-size: 18px;
    }

    .article-excerpt {
        font-size: 14px;
    }

    .modal-content {
        margin: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer,
    .modal-meta {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 22px;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .back-btn {
        color: #999;
        border-color: #3c3c3c;
    }

    .back-btn:hover {
        color: #e0e0e0;
        border-color: #e0e0e0;
    }

    .header-left h1 {
        color: #ffffff;
    }

    .subtitle {
        color: #999;
    }

    .btn {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .btn:hover {
        background: #333333;
        border-color: #e0e0e0;
        box-shadow: 0 2px 12px rgba(224, 224, 224, 0.08);
    }

    .btn-primary {
        background: #0d6efd;
        border-color: #0d6efd;
    }

    .btn-primary:hover {
        background: #0b5ed7;
        border-color: #0b5ed7;
    }

    .stats-item {
        color: #999;
    }

    .stats-item strong {
        color: #e0e0e0;
    }

    /* 搜索框样式 */
    .search-box input {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .search-box input::placeholder {
        color: #666;
    }

    .search-box input:focus {
        border-color: #e0e0e0;
        background: #333333;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    .search-section input {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .search-section input::placeholder {
        color: #666;
    }

    .search-section input:focus {
        border-color: #e0e0e0;
        background: #333333;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    .search-section button {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .search-section button:hover {
        background: #333333;
        border-color: #e0e0e0;
    }

    .create-btn,
    .view-trash-btn {
        background: #2c2c2c;
        border-color: #3c3c3c;
        color: #e0e0e0;
    }

    .create-btn:hover,
    .view-trash-btn:hover {
        background: #333333;
        border-color: #e0e0e0;
    }

    /* 标签过滤按钮 */
    .tag-btn {
        background: #2c2c2c;
        border-color: #3c3c3c;
        color: #999;
    }

    .tag-btn:hover {
        background: #333333;
        border-color: #e0e0e0;
        color: #e0e0e0;
    }

    .tag-btn.active {
        background: #e0e0e0;
        color: #1a1a1a;
        border-color: #e0e0e0;
    }

    /* 文章卡片 */
    .article-card {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .article-card:hover {
        border-color: #e0e0e0;
        box-shadow: 0 2px 12px rgba(224, 224, 224, 0.08);
    }

    .article-card::before {
        background: #e0e0e0;
    }

    .article-title {
        color: #ffffff;
    }

    .article-excerpt {
        color: #b0b0b0;
        border-left-color: #3c3c3c;
    }

    .article-meta {
        color: #666;
    }

    .article-tag {
        background: #3c3c3c;
        border-color: #4c4c4c;
        color: #999;
    }

    /* 骨架屏 */
    .skeleton-card {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .skeleton-card::before,
    .skeleton-card::after {
        background: linear-gradient(90deg, #3c3c3c 25%, #4c4c4c 50%, #3c3c3c 75%);
        background-size: 200% 100%;
    }

    /* 空状态 */
    .empty-state h3 {
        color: #ffffff;
    }

    .empty-state p {
        color: #666;
    }

    .fragment-card {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .fragment-card:hover {
        border-color: #e0e0e0;
        box-shadow: 0 4px 16px rgba(224, 224, 224, 0.1);
    }

    .fragment-content {
        color: #b0b0b0;
    }

    .fragment-content h1,
    .fragment-content h2,
    .fragment-content h3 {
        color: #ffffff;
    }

    .fragment-content code {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .fragment-content pre {
        background: #1a1a1a;
        border-color: #3c3c3c;
    }

    .fragment-content blockquote {
        border-left-color: #3c3c3c;
        color: #999;
    }

    .fragment-content a {
        color: #58a6ff;
    }

    .fragment-content a:hover {
        color: #79b8ff;
    }

    .fragment-meta {
        color: #666;
        border-top-color: #3c3c3c;
    }

    .fragment-actions button {
        color: #999;
    }

    .fragment-actions button:hover {
        color: #e0e0e0;
    }

    .empty-state {
        color: #666;
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.7);
    }

    .modal-content {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }

    .modal-close {
        color: #999;
    }

    .modal-close:hover {
        color: #e0e0e0;
    }

    .modal-header {
        border-bottom-color: #3c3c3c;
    }

    .modal-header h2 {
        color: #ffffff;
    }

    .modal-body textarea,
    .modal-body input {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .modal-body textarea::placeholder,
    .modal-body input::placeholder {
        color: #666;
    }

    .modal-body textarea:focus,
    .modal-body input:focus {
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    .fragment-preview {
        background: #1a1a1a;
        border-color: #3c3c3c;
    }

    .fragment-preview h1,
    .fragment-preview h2,
    .fragment-preview h3 {
        color: #ffffff;
    }

    .fragment-preview p,
    .fragment-preview li {
        color: #b0b0b0;
    }

    .fragment-preview code {
        background: #2c2c2c;
        color: #e0e0e0;
    }

    .fragment-preview pre {
        background: #2c2c2c;
        border-color: #444;
    }

    .fragment-preview blockquote {
        border-left-color: #3c3c3c;
        color: #999;
    }

    .modal-meta {
        background: #1a1a1a;
        border-top-color: #3c3c3c;
        border-bottom-color: #3c3c3c;
    }

    .meta-time {
        color: #666;
    }

    .meta-tag {
        background: #2c2c2c;
        border-color: #3c3c3c;
        color: #999;
    }

    /* Markdown 内容样式 */
    .markdown-body {
        color: #b0b0b0;
    }

    .markdown-body h1,
    .markdown-body h2,
    .markdown-body h3,
    .markdown-body h4,
    .markdown-body h5,
    .markdown-body h6 {
        color: #ffffff;
    }

    .markdown-body h1 {
        border-bottom-color: #3c3c3c;
    }

    .markdown-body h2 {
        border-bottom-color: #3c3c3c;
    }

    .markdown-body code {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .markdown-body pre {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .markdown-body pre code {
        background: none;
        color: inherit;
    }

    .markdown-body blockquote {
        border-left-color: #667eea;
        color: #999;
    }

    .markdown-body a {
        color: #58a6ff;
    }

    .markdown-body a:hover {
        color: #79b8ff;
    }

    .markdown-body strong {
        color: #ffffff;
    }

    .modal-footer {
        background: #1a1a1a;
        border-top-color: #3c3c3c;
    }

    /* 登录表单 */
    .login-form p {
        color: #999;
    }

    .login-form label {
        color: #e0e0e0;
    }

    .login-form input {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #3c3c3c;
    }

    .login-form input::placeholder {
        color: #666;
    }

    .login-form input:focus {
        background: #1a1a1a;
        border-color: #e0e0e0;
        box-shadow: 0 0 0 3px rgba(224, 224, 224, 0.05);
    }

    .login-error {
        background: #3c1f1f;
        border-color: #6c2626;
        color: #ff6b6b;
    }

    .char-count {
        color: #666;
    }

    /* Toast 暗色模式 */
    .toast {
        background: #2c2c2c;
        color: #e0e0e0;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
}
