/* ==================== Telegraph Common Styles ==================== */

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font: 18px/1.67 'PT Serif', Georgia, serif;
    color: #222;
    background: #fff;
    padding: 60px 20px 120px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.wrap {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

/* Typography */
h1 {
    font-size: 46px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 16px;
    word-wrap: break-word;
    letter-spacing: -0.02em;
    color: #000;
}

h2 {
    font-size: 36px;
    margin: 1.5em 0 0.5em;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

h3 {
    font-size: 32px;
    margin: 1.5em 0 0.5em;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h4 {
    font-size: 24px;
    margin: 1.3em 0 0.4em;
    font-weight: 700;
    line-height: 1.3;
}

/* Content Formatting */
p, h2, h3, h4, blockquote, ul, ol, pre {
    margin: 1em 0;
    line-height: 1.67;
    position: relative;
}

p:first-child {
    margin-top: 0;
}

p:empty {
    min-height: 1.67em;
}

p:empty:before {
    content: '\200B';
}

blockquote {
    border-left: 3px solid #000;
    padding-left: 20px;
    color: #666;
    font-style: italic;
    margin: 1.5em 0;
}

hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 2em 0;
}

/* Code Blocks */
code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #e83e8c;
}

pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    margin: 1.5em 0;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Text Formatting */
del, s {
    text-decoration: line-through;
    color: #999;
}

mark {
    background: #fff3cd;
    padding: 2px 4px;
}

b, strong {
    font-weight: 700;
}

i, em {
    font-style: italic;
}

/* Links */
a {
    color: #000;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    word-break: break-word;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.7;
}

/* Link Preview Cards */
.link-preview {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5em 0;
    transition: all 0.2s ease;
    background: #fff;
    display: block;
    color: inherit;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    text-decoration: none;
}

.link-preview:hover {
    border-color: #c0c0c0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.link-preview[data-style="compact"] {
    display: flex;
    flex-direction: row;
}

.link-preview[data-style="compact"] .link-preview-image {
    width: 180px;
    height: 120px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid #e0e0e0;
}

.link-preview-image {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #e0e0e0;
}

.link-preview-content {
    padding: 16px;
    flex: 1;
}

.link-preview-title {
    font: 16px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-description {
    font: 14px/1.5 -apple-system, system-ui, sans-serif;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.link-preview-url {
    font: 13px/1.4 -apple-system, system-ui, sans-serif;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-preview-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

/* Lists */
ul, ol {
    padding-left: 30px;
    margin: 1em 0;
}

li {
    margin: 0.5em 0;
}

/* Images and Videos */
figure {
    margin: 2em 0;
    text-align: center;
    position: relative;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 0;
}

img.lazy {
    background: #f5f5f5;
    min-height: 200px;
}

video {
    background: #000;
}

figcaption {
    font: 15px/1.5 -apple-system, system-ui, sans-serif;
    color: #666;
    margin-top: 12px;
    text-align: center;
    font-style: italic;
}

iframe {
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border: none;
}

/* Button */
.btn {
    position: fixed;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 10px 24px;
    border-radius: 24px;
    cursor: pointer;
    font: 15px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: none;
    text-decoration: none;
    display: inline-block;
    z-index: 1000;
}

.btn:hover {
    background: #000;
    color: #fff;
}

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

.btn:disabled {
    background: #f5f5f5;
    color: #999;
    border-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    min-width: 200px;
    max-width: 280px;
    z-index: 2000;
    display: none;
    animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-section {
    padding: 8px 16px 4px;
    font: 11px/1.4 -apple-system, system-ui, sans-serif;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font: 14px/1.4 -apple-system, system-ui, sans-serif;
    color: #222;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-item .icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.context-menu-item .label {
    flex: 1;
}

.context-menu-item .shortcut {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.context-menu-item.danger {
    color: #dc2626;
}

.context-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 6px 12px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 480px;
    width: 90%;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-title {
    font: 18px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
    color: #000;
}

.modal-body {
    padding: 24px;
}

.modal-input,
.modal-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font: 16px/1.5 -apple-system, system-ui, sans-serif;
    transition: border-color 0.2s;
    outline: none;
    font-family: 'PT Serif', Georgia, serif;
}

.modal-textarea {
    min-height: 120px;
    resize: vertical;
}

.modal-input:focus,
.modal-textarea:focus {
    border-color: #000;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font: 15px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.modal-btn-cancel:hover {
    background: #e0e0e0;
}

.modal-btn-confirm {
    background: #000;
    color: #fff;
}

.modal-btn-confirm:hover {
    background: #333;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    font: 14px/1.4 -apple-system, system-ui, sans-serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: rgba(220, 38, 38, 0.95);
}

.toast.success {
    background: rgba(34, 197, 94, 0.95);
}

/* Loading */
.loading {
    color: #999;
    font-style: italic;
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Upload Progress */
.upload-progress {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 280px;
    z-index: 4000;
    display: none;
}

.upload-progress.show {
    display: block;
}

.upload-progress-title {
    font: 14px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-progress-bar {
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: #000;
    width: 0%;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font: 13px/1.4 -apple-system, system-ui, sans-serif;
    color: #666;
}

/* Image Editor */
.image-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
}

.image-editor-overlay.show {
    display: flex;
}

.image-editor {
    background: #fff;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.image-editor-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-editor-title {
    font: 18px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
}

.image-editor-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.image-editor-close:hover {
    background: #f5f5f5;
}

.image-editor-body {
    padding: 20px;
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-editor-canvas-wrap {
    max-width: 100%;
    max-height: 100%;
    position: relative;
}

.image-editor-canvas {
    max-width: 100%;
    max-height: 60vh;
    display: block;
}

.image-editor-toolbar {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.image-editor-btn {
    padding: 8px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    font: 14px/1.4 -apple-system, system-ui, sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-editor-btn:hover {
    background: #f5f5f5;
    border-color: #a0a0a0;
}

.image-editor-btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}

.image-editor-btn-primary:hover {
    background: #333;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 40px 16px 100px;
        font-size: 17px;
    }

    h1 {
        font-size: 36px;
        margin-bottom: 12px;
    }

    h2 {
        font-size: 30px;
    }

    h3 {
        font-size: 28px;
    }

    h4 {
        font-size: 22px;
    }

    .link-preview-image {
        height: 160px;
    }

    .link-preview[data-style="compact"] {
        flex-direction: column;
    }

    .link-preview[data-style="compact"] .link-preview-image {
        width: 100%;
        height: 160px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .modal {
        width: 95%;
    }

    .upload-progress {
        bottom: 20px;
        right: 20px;
        left: 20px;
        min-width: auto;
    }

    .image-editor {
        max-height: 95vh;
    }

    .image-editor-toolbar {
        overflow-x: auto;
        justify-content: flex-start;
    }

    .btn {
        bottom: 20px;
        left: 20px;
        top: auto;
        right: auto;
        padding: 12px 28px;
        font-size: 14px;
    }
}

@media (min-width: 769px) {
    .btn {
        top: 20px;
        right: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    body {
        padding: 50px 30px 120px;
    }

    .wrap {
        max-width: 720px;
    }
}

/* Selection */
::selection {
    background: rgba(0, 0, 0, 0.1);
}

:focus {
    outline: none;
}

/* ==================== 移动端优化 ==================== */

/* 文件卡片样式 */
.file-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 1.5em 0;
    transition: all 0.2s;
}

.file-card:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.file-card-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-weight: 600;
    font-size: 15px;
    color: #000;
    word-break: break-all;
    margin-bottom: 4px;
}

.file-card-meta {
    font-size: 13px;
    color: #666;
}

.file-card-download {
    background: #000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.file-card-download:hover {
    background: #333;
    opacity: 1;
}

/* 音频播放器样式 */
audio {
    width: 100%;
    margin: 1.5em 0;
    border-radius: 8px;
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    /* 触摸目标最小尺寸 */
    .btn,
    .modal-btn,
    .context-menu-item,
    .image-editor-btn,
    .file-card-download {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 上下文菜单适配 */
    .context-menu {
        max-width: 90vw;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .context-menu-item {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    .context-menu-item .icon {
        width: 24px;
        height: 24px;
        font-size: 20px;
    }
    
    /* 模态框适配 */
    .modal {
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* 图片编辑器适配 */
    .image-editor {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .image-editor-canvas {
        max-height: 50vh;
    }
    
    .image-editor-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .image-editor-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        justify-content: center;
    }
    
    /* Toast位置调整 */
    .toast {
        bottom: 80px;
        left: 16px;
        right: 16px;
        transform: translateX(0) translateY(0);
        width: auto;
    }
    
    .toast.show {
        transform: translateX(0) translateY(0);
    }
    
    /* 上传进度条 */
    .upload-progress {
        bottom: 80px;
        left: 16px;
        right: 16px;
        min-width: auto;
    }
    
    /* 文件卡片 */
    .file-card {
        flex-direction: column;
        text-align: center;
    }
    
    .file-card-download {
        width: 100%;
        text-align: center;
    }
    
    /* 链接预览卡片 */
    .link-preview[data-style="compact"] {
        flex-direction: column;
    }
    
    .link-preview[data-style="compact"] .link-preview-image {
        width: 100%;
        height: 160px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    /* 按钮位置 */
    .btn {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        top: auto;
        z-index: 1000;
    }
    
    /* 内容区域底部padding */
    #content {
        padding-bottom: 100px;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    body {
        padding: 30px 12px 120px;
        font-size: 16px;
    }
    
    h1 {
        font-size: 32px;
    }
    
    h2 {
        font-size: 26px;
    }
    
    h3 {
        font-size: 24px;
    }
    
    .modal {
        width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .image-editor-btn {
        flex: 1 1 100%;
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* 横屏模式 */
@media (max-width: 768px) and (orientation: landscape) {
    .image-editor-canvas {
        max-height: 40vh;
    }
    
    .modal-body {
        max-height: 40vh;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    a, button, input, select, textarea {
        min-height: 44px;
    }
    
    /* 移除hover效果 */
    .btn:hover,
    .context-menu-item:hover,
    .file-card:hover,
    .link-preview:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* 使用active状态 */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .context-menu-item:active {
        background: #e0e0e0;
    }
}

/* PWA全屏模式 */
@media (display-mode: standalone) {
    body {
        padding-top: max(40px, env(safe-area-inset-top));
        padding-bottom: max(120px, env(safe-area-inset-bottom));
    }
    
    .btn {
        bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .toast {
        bottom: max(80px, calc(env(safe-area-inset-bottom) + 60px));
    }
}/* ==================== 音频播放器优化 ==================== */
audio {
    width: 100%;
    margin: 1.5em 0;
    border-radius: 8px;
    background: #f9f9f9;
    padding: 8px;
}

figure audio + figcaption {
    margin-top: 8px;
    text-align: left;
    font-size: 14px;
}

/* ==================== 文件卡片优化 ==================== */
.file-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 1.5em 0;
    transition: all 0.2s;
    cursor: default;
}

.file-card:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.file-card-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-weight: 600;
    font-size: 15px;
    color: #000;
    word-break: break-all;
    margin-bottom: 4px;
}

.file-card-meta {
    font-size: 13px;
    color: #666;
}

.file-card-download {
    background: #000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.file-card-download:hover {
    background: #333;
    opacity: 1;
}

/* ==================== 图片编辑器裁剪模式 ==================== */
.image-editor-canvas {
    cursor: crosshair;
}

.image-editor-canvas.cropping {
    cursor: move;
}

@media (max-width: 768px) {
    .file-card {
        flex-direction: column;
        text-align: center;
    }
    
    .file-card-download {
        width: 100%;
        text-align: center;
    }
}
/* ==================== 文件卡片样式（简约黑白风格） ==================== */
.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 1.5em 0;
    transition: all 0.2s;
    position: relative;
    cursor: move;
}

.file-card:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.file-card-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-weight: 600;
    font-size: 14px;
    color: #000;
    word-break: break-all;
    margin-bottom: 4px;
    font-family: -apple-system, system-ui, sans-serif;
}

.file-card-meta {
    font-size: 12px;
    color: #666;
    font-family: -apple-system, system-ui, sans-serif;
}

.file-card-download {
    background: #000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: -apple-system, system-ui, sans-serif;
    border: 1px solid #000;
}

.file-card-download:hover {
    background: #333;
    border-color: #333;
    opacity: 1;
}

/* 音频卡片样式（简约风格） */
figure audio {
    width: 100%;
    margin: 0;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px;
}

figure.audio-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    margin: 1.5em 0;
    position: relative;
    cursor: move;
}

figure.audio-card audio {
    border: none;
    background: transparent;
    padding: 0;
}

figure.audio-card figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: #666;
    text-align: left;
    font-style: normal;
}

/* 图片样式优化 */
figure {
    position: relative;
}

figure img {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* 视频样式优化 */
figure video {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* 可调整大小的元素样式 */
.resizable {
    position: relative;
}

.resizable.resizing {
    user-select: none;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #000;
    border: 1px solid #fff;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.resizable:hover .resize-handle {
    opacity: 0.6;
}

.resize-handle:hover {
    opacity: 1;
}

.resize-handle-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-handle-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* 拖拽中的样式 */
.dragging {
    opacity: 0.7;
    cursor: move !important;
}

/* 链接预览卡片优化（简约黑白） */
.link-preview {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5em 0;
    transition: all 0.2s ease;
    background: #fff;
    display: block;
    color: inherit;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    text-decoration: none;
}

.link-preview:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.link-preview-image {
    width: 100%;
    height: 180px;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #e0e0e0;
}

.link-preview-content {
    padding: 14px;
}

.link-preview-title {
    font: 15px/1.4 -apple-system, system-ui, sans-serif;
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-description {
    font: 13px/1.4 -apple-system, system-ui, sans-serif;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.link-preview-url {
    font: 12px/1.4 -apple-system, system-ui, sans-serif;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-preview-favicon {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

/* 紧凑模式 */
.link-preview[data-style="compact"] {
    display: flex;
    flex-direction: row;
}

.link-preview[data-style="compact"] .link-preview-image {
    width: 140px;
    height: 100px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid #e0e0e0;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .file-card {
        gap: 10px;
        padding: 14px;
    }
    
    .file-card-icon {
        font-size: 24px;
    }
    
    .file-card-name {
        font-size: 13px;
    }
    
    .file-card-download {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    figure.audio-card {
        padding: 12px;
    }
    
    .link-preview[data-style="compact"] {
        flex-direction: column;
    }
    
    .link-preview[data-style="compact"] .link-preview-image {
        width: 100%;
        height: 140px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .link-preview-image {
        height: 140px;
    }
}