* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f6f9fc;
    font-size: 16px;
    line-height: 1.5;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    transition: 0.3s;
}

.glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
    top: -150px;
    right: -150px;
    filter: blur(60px);
    animation: floatGlow 8s infinite alternate ease-in-out;
    z-index: -1;
}

@keyframes floatGlow {
    from { transform: translateY(0); }
    to { transform: translateY(40px); }
}

/* 桌面端网格布局 */
@media (min-width: 769px) {
    .app-container {
        display: grid;
        grid-template-columns: 220px 1fr 260px;
        grid-template-rows: auto 1fr;
        height: 100vh;
        background: transparent;
    }

    /* 顶部栏跨三列，内部使用子网格对齐 */
    .top-header {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
        align-items: center;
        background: rgba(255, 255, 255, 0.65);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.4);
        padding: 12px 0;
        z-index: 10;
    }

    .logo {
        font-size: 1.5rem;
        grid-column: 1;
        justify-self: start;
        margin-left: 28px;
        font-size: 28px;
        font-weight: 800;
        background: linear-gradient(135deg, #2563eb, #4f46e5);
        background-clip: text;
        -webkit-background-clip: text;
        color: transparent;
        white-space: nowrap;
        line-height: 1;
        text-decoration: none;   /* 去掉下划线 */
    }

    .top-header .search {
        grid-column: 2;
        width: 100%;
        padding: 10px 20px;
        border: none;
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        font-size: 0.95rem;
        height: 44px;
        line-height: 1.4;
    }

    .new-btn {
        grid-column: 3;
        justify-self: end;
        margin-right: 28px;
        background: linear-gradient(135deg, #3b82f6, #6366f1);
        color: white;
        font-weight: 600;
        padding: 0 24px;
        border-radius: 12px;
        border: none;
        cursor: pointer;
        box-shadow: 0 6px 14px rgba(59, 130, 246, 0.3);
        white-space: nowrap;
        height: 42px;
        line-height: 42px;
        font-size: 1.0rem;
    }

    /* 主体区域也使用子网格 */
    .main-layout {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
        overflow: hidden;
    }

    .sidebar {
        grid-column: 1;
        background: rgba(255, 255, 255, 0.68);
        backdrop-filter: blur(18px);
        border-right: 1px solid rgba(255, 255, 255, 0.5);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 24px 12px;
    }

    .feed {
        grid-column: 2;
        overflow-y: auto;
        padding: 24px 28px;
        scroll-behavior: smooth;
    }

    .rightbar {
        grid-column: 3;
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(16px);
        border-left: 1px solid rgba(255, 255, 255, 0.4);
        overflow-y: auto;
        padding: 24px 16px;
    }
}

/* 手机端原有样式，保持不变 */
@media (max-width: 768px) {
    .app-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }
    .top-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.65);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.4);
        z-index: 10;
        flex-shrink: 0;
    }
    .logo {
        font-size: 1.5rem;
        font-weight: 800;
        background: linear-gradient(135deg, #2563eb, #4f46e5);
        background-clip: text;
        -webkit-background-clip: text;
        color: transparent;
        white-space: nowrap;
         text-decoration: none;   /* 去掉下划线 */
    }
    .top-header .search {
        flex: 1;
        padding: 8px 12px;
        border: none;
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        font-size: 0.85rem;
        height: 40px;
        margin: 0 8px;    /* 左右各8px */
    }
    .new-btn {
        background: linear-gradient(135deg, #3b82f6, #6366f1);
        color: white;
        font-weight: 600;
        padding: 0 20px;
        border-radius: 12px;
        border: none;
        cursor: pointer;
        box-shadow: 0 6px 14px rgba(59, 130, 246, 0.3);
        font-size: 1.0rem;
        height: 42px;
        line-height: 42px;
        white-space: nowrap;
    }
    .main-layout {
        display: flex;
        flex: 1;
        overflow: hidden;
        position: relative;
    }
    .sidebar, .rightbar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(28px);
    }
    .sidebar {
        left: 0;
        width: 40%;          /* 改为屏幕宽度的80% */
        border-radius: 0 20px 20px 0;
        padding: 24px 12px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .rightbar {
        right: 0;
        transform: translateX(100%);
        width: 50%;          /* 改为屏幕宽度的80% */
        border-radius: 20px 0 0 20px;
        padding: 24px 16px;
    }
    .show-left .sidebar {
        transform: translateX(0);
    }
    .show-right .rightbar {
        transform: translateX(0);
    }
    .menu-overlay {
        position: fixed;
        inset: 0;
        /* background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(3px); */
        background: transparent;   /* 完全透明，无灰色 */
        backdrop-filter: none;     /* 移除模糊效果 */
        z-index: 180;
        display: none;
    }
    .show-left .menu-overlay, .show-right .menu-overlay {
        display: block;
    }
    .feed {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }
}

/* 公共样式（桌面/手机共用） */
.nav-items {
    flex: 1;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #1f2937;
    font-size: 1rem;
}

.nav-item.active {
    background: linear-gradient(135deg, #dbeafe, #eef2ff);
    color: #2563eb;
    font-weight: 600;
}

.action-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 30px;
    padding: 10px 16px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    margin-bottom: 12px;
    transition: 0.2s;
}
.action-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

.sidebar-divider {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 12px 0 16px 0;
}

.panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1rem;
}

.panel-header span:first-child {
    font-size: 1.2rem;
}

.style-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 0;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.stat {
    font-size: 32px;
    font-weight: 800;
    color: #2563eb;
    margin-top: 6px;
}

.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: 0.25s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.card.favorited-border {
    border-color: #f59e0b;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.2);
}

.card.favorited-title .card-title {
    color: #f59e0b;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    transition: color 0.2s ease;
}

.card-content {
    line-height: 1.6;
    margin-bottom: 10px;
    word-break: break-word;
    overflow: hidden;
    transition: all 0.3s ease;
}
/* 卡片内图片自适应宽度，避免溢出 */
.card-content img {
    max-width: 100%;
    height: auto;
    display: block;          /* 避免图片底部留白 */
    margin: 8px auto;        /* 居中显示，上下边距 */
    border-radius: 8px;      /* 可选，让图片更圆润 */
}
.card-content.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: none;
}
/* 新增：收起时限制图片高度 */
.card-content.collapsed img {
    max-height: 100px;
    width: auto;
    object-fit: cover;
    margin: 8px 0;
    border-radius: 6px;
}
.card-content.expanded {
    display: block;
    max-height: none;
}
/* 可选：展开时恢复图片原始样式 */
.card-content.expanded img {
    max-height: none;
    width: auto;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.card-meta.hidden {
    display: none;
}

.card-tags span {
    display: inline-block;
    background: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    margin-right: 6px;
    color: #2563eb;
    cursor: pointer;
}
.card-tags span.active-filter {
    background: #2563eb;
    color: white;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    width: 700px;
    max-width: 90%;
    background: white;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}
.modal-visibility select {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 0;
    cursor: pointer;
}

#expTitle,
.tags-visibility-row input,
.modal-visibility select,
.ql-container,
.ql-toolbar {
    border-radius: 0 !important;
}

#expTitle {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 8px;
}

.char-counter {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
    margin-bottom: 16px;
}

.tags-visibility-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 16px 0;
}
.tags-visibility-row input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 16px;
}
.modal-actions button {
    padding: 8px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 8px;
    white-space: nowrap;
}
.save-btn {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
}
.cancel-btn {
    background: linear-gradient(135deg, #f5f7fa, #e9ecef);
    color: #374151;
}
.delete-exp-btn {
    background: #ef4444;
    color: white;
}

#editor-container {
    height: 200px;
    margin-bottom: 8px;
}

/* 夜间模式 */
.dark {
    background: #0b1120;
}
.dark .top-header,
.dark .sidebar,
.dark .rightbar,
.dark .card,
.dark .panel,
.dark .modal-box {
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(16px);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.08);
}
.dark .search,
.dark #expTitle,
.dark .tags-visibility-row input,
.dark .modal-visibility select,
.dark .style-select {
    background: #1e293b;
    color: white;
    border-color: #334155;
}
.dark .card-tags span {
    background: #334155;
    color: #93c5fd;
}
.dark .card-tags span.active-filter {
    background: #2563eb;
    color: white;
}
.dark .card-title {
    color: #f1f5f9;
}
.dark .card.favorited-border {
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3), 0 8px 20px rgba(251, 191, 36, 0.2);
}
.dark .card.favorited-title .card-title {
    color: #fbbf24;
}
.dark .nav-item {
    color: #e2e8f0;
}
.dark .nav-item.active {
    background: #2563eb30;
    color: #60a5fa;
}
.dark .action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}
.dark .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.dark .sidebar-divider {
    border-top-color: rgba(255, 255, 255, 0.2);
}
.dark .cancel-btn {
    background: linear-gradient(135deg, #334155, #1e293b);
    color: #e2e8f0;
    border: 1px solid #475569;
}



/* 设置 Quill 编辑器内容的字体大小 */
.ql-editor {
    font-size: 1rem;
}