/* ═══════════════════════════════════════════════════════════
   驿站 (Yizhan) —— Telegraph 极简排版与交互样式表
   完全模仿 https://telegra.ph/ 的精简界面与 Markdown 写作体验
   ═══════════════════════════════════════════════════════════ */

:root {
    --tl-bg: #ffffff;
    --tl-fg: #222222;
    --tl-fg-muted: #79828b;
    --tl-fg-light: #9eaab6;
    --tl-border: #e6e6e6;
    --tl-link: #2489ce;
    --tl-link-hover: #1b669b;
    --tl-code-bg: #f5f6f8;
    --tl-bubble-bg: #222222;
    --tl-bubble-fg: #ffffff;
    --tl-accent: #2ea44f;
    --tl-accent-hover: #2c974b;
    --tl-danger: #cf222e;
    --tl-max-width: 760px;
    --tl-font-serif: Georgia, Cambria, "Times New Roman", "Songti SC", "Source Han Serif CN", serif;
    --tl-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --tl-font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    background-color: var(--tl-bg);
}

body {
    background-color: var(--tl-bg);
    color: var(--tl-fg);
    font-family: var(--tl-font-serif);
    font-size: 18px;
    line-height: 1.68;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--tl-fg);
    text-decoration: underline;
    text-decoration-color: rgba(34, 34, 34, 0.25);
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover {
    color: var(--tl-link);
    text-decoration-color: var(--tl-link);
}

.hidden { display: none !important; }

/* ── 顶部极简导航栏 ── */
.tl-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 54px;
}

.tl-header-inner {
    max-width: var(--tl-max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.tl-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--tl-font-sans);
}

/* ── 底部极简导航栏 (Logo、传文件、管理) ── */
.tl-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: auto;
    padding: 24px 0 36px;
    font-family: var(--tl-font-sans);
}

.tl-footer-inner {
    max-width: var(--tl-max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tl-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tl-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tl-fg-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.tl-footer-logo:hover {
    color: var(--tl-fg);
    text-decoration: none;
}

.tl-footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.tl-footer-link {
    background: transparent;
    border: none;
    color: var(--tl-fg-muted);
    font-size: 14px;
    font-family: var(--tl-font-sans);
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: color 0.15s ease;
}
.tl-footer-link:hover {
    color: var(--tl-fg);
    text-decoration: underline;
}

/* 传文件专属全屏面板 */
.tl-file-upload-view {
    padding: 10px 0 40px;
    font-family: var(--tl-font-sans);
}
.tl-file-upload-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--tl-fg);
    letter-spacing: -0.02em;
}
.tl-file-upload-subtitle {
    color: var(--tl-fg-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

.tl-btn-ghost {
    background: transparent;
    border: none;
    color: var(--tl-fg-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tl-btn-ghost:hover {
    color: var(--tl-fg);
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}
.tl-btn-ghost.active {
    color: var(--tl-fg);
    background: rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

/* Telegraph 经典胶囊按钮 */
.tl-btn-pill {
    background: #2489ce;
    color: #ffffff !important;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 18px;
    cursor: pointer;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.tl-btn-pill:hover:not(:disabled) {
    background: #1b669b;
    transform: translateY(-0.5px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}
.tl-btn-pill:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.tl-btn-pill:disabled {
    background: #d8dee4;
    color: #8c959f !important;
    cursor: not-allowed;
    box-shadow: none;
}
.tl-btn-pill.success {
    background: #2ea44f;
}
.tl-btn-pill.success:hover:not(:disabled) {
    background: #2c974b;
}

/* ── 主内容区 ── */
.tl-container {
    max-width: var(--tl-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 36px 20px 80px;
    flex: 1;
    position: relative;
}

/* ── Telegraph 文章头部排版 ── */
.tl-article-header {
    margin-bottom: 24px;
}

.tl-title-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--tl-font-sans);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--tl-fg);
    margin: 0 0 12px;
    padding: 0;
    letter-spacing: -0.02em;
    resize: none;
    overflow: hidden;
}
.tl-title-input::placeholder {
    color: var(--tl-fg-light);
    font-weight: 700;
}

.tl-author-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--tl-font-sans);
    font-size: 15px;
    color: var(--tl-fg-muted);
    margin: 0;
    padding: 0;
}
.tl-author-input::placeholder {
    color: var(--tl-fg-light);
}

.tl-article-meta {
    font-family: var(--tl-font-sans);
    font-size: 15px;
    color: var(--tl-fg-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tl-article-meta .tl-meta-author {
    font-weight: 500;
    color: var(--tl-fg);
}
.tl-article-meta .tl-meta-dot {
    color: var(--tl-fg-light);
}

/* ── Telegraph 正文与编辑器排版 (Article & ContentEditable & Prose) ── */
.tl-content {
    min-height: 380px;
    outline: none;
    position: relative;
    font-family: var(--tl-font-serif);
    font-size: 18px;
    line-height: 1.68;
    color: var(--tl-fg);
    word-break: break-word;
}

/* 编辑器占位符 */
.tl-content.empty:before {
    content: attr(data-placeholder);
    position: absolute;
    top: 0;
    left: 0;
    color: var(--tl-fg-light);
    pointer-events: none;
    font-style: normal;
}

/* 正文段落与标签排版（阅读页与编辑器完全一致） */
.tl-content p,
.tl-prose p {
    margin: 0 0 1.2em;
}

.tl-content h1, .tl-prose h1,
.tl-content h2, .tl-prose h2,
.tl-content h3, .tl-prose h3 {
    font-family: var(--tl-font-sans);
    color: var(--tl-fg);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.tl-content h2, .tl-prose h2 {
    font-size: 26px;
    margin: 32px 0 14px;
}

.tl-content h3, .tl-prose h3 {
    font-size: 21px;
    margin: 26px 0 10px;
}

.tl-content h4, .tl-prose h4 {
    font-size: 18px;
    margin: 20px 0 8px;
}

/* Telegraph 经典引用样式 */
.tl-content blockquote,
.tl-prose blockquote {
    border-left: 3px solid var(--tl-fg);
    padding: 4px 0 4px 18px;
    margin: 20px 0;
    color: var(--tl-fg);
    font-style: italic;
}

/* Telegraph Pull Quote（大号居中引用样式） */
.tl-content blockquote.pullquote,
.tl-prose blockquote.pullquote {
    border-left: none;
    text-align: center;
    font-size: 24px;
    line-height: 1.4;
    margin: 36px auto;
    max-width: 85%;
    padding: 0;
    font-style: italic;
    color: #111;
}

/* 列表排版 */
.tl-content ul, .tl-prose ul {
    list-style: disc;
    margin: 0 0 1.2em 24px;
    padding: 0;
}
.tl-content ol, .tl-prose ol {
    list-style: decimal;
    margin: 0 0 1.2em 24px;
    padding: 0;
}
.tl-content li, .tl-prose li {
    margin-bottom: 0.35em;
}

/* 行内代码与代码块 */
.tl-content code, .tl-prose code {
    font-family: var(--tl-font-mono);
    font-size: 0.88em;
    background: var(--tl-code-bg);
    border-radius: 4px;
    padding: 2px 6px;
    color: #24292f;
}

.tl-content pre, .tl-prose pre {
    background: var(--tl-code-bg);
    border-radius: 8px;
    padding: 16px 18px;
    margin: 20px 0;
    overflow-x: auto;
    font-size: 14.5px;
    line-height: 1.55;
    position: relative;
}
.tl-content pre code, .tl-prose pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

/* Telegraph 经典三点分割线 */
.tl-content hr, .tl-prose hr {
    border: none;
    text-align: center;
    margin: 36px 0;
    height: auto;
}
.tl-content hr:after, .tl-prose hr:after {
    content: "* * *";
    font-family: var(--tl-font-sans);
    font-size: 24px;
    letter-spacing: 0.6em;
    color: var(--tl-fg-muted);
}

/* Telegraph 下划线/旁注/媒体 */
.tl-content u, .tl-prose u {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.tl-content aside, .tl-prose aside {
    background: #fafbfc;
    border-left: 3px solid #e6e6e6;
    padding: 12px 16px;
    margin: 20px 0;
    font-family: var(--tl-font-sans);
    font-size: 15px;
    color: var(--tl-fg-muted);
    font-style: normal;
}
.tl-content iframe, .tl-prose iframe,
.tl-content video, .tl-prose video {
    max-width: 100%;
    width: 100%;
    border: none;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    background: #000;
}
.tl-content h3, .tl-prose h3 { font-size: 26px; margin: 32px 0 14px; }
.tl-content h4, .tl-prose h4 { font-size: 21px; margin: 26px 0 10px; }

/* 图片与图说 Figure / Figcaption */
.tl-content figure, .tl-prose figure {
    margin: 28px 0;
    text-align: center;
}
.tl-content img, .tl-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}
.tl-content figcaption, .tl-prose figcaption {
    font-family: var(--tl-font-sans);
    font-size: 14px;
    color: var(--tl-fg-muted);
    margin-top: 8px;
    font-style: italic;
}

/* 表格排版 */
.tl-content table, .tl-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 16px;
    font-family: var(--tl-font-sans);
}
.tl-content th, .tl-prose th,
.tl-content td, .tl-prose td {
    border: 1px solid var(--tl-border);
    padding: 8px 12px;
    text-align: left;
}
.tl-content th, .tl-prose th {
    background: #f8f9fa;
    font-weight: 600;
}

/* ── Markdown 源码编辑模式 (Raw Markdown Mode) ── */
.tl-markdown-editor {
    width: 100%;
    min-height: 380px;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--tl-font-mono);
    font-size: 16px;
    line-height: 1.6;
    color: var(--tl-fg);
    resize: none;
    overflow: hidden;
    padding: 0;
}
.tl-markdown-editor::placeholder {
    color: var(--tl-fg-light);
}

/* ── Telegraph 黑色浮动气泡工具条 (Bubble Toolbar) ── */
.tl-bubble-toolbar {
    position: absolute;
    z-index: 500;
    background: var(--tl-bubble-bg);
    border-radius: 8px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translate(-50%, -100%);
    margin-top: -10px;
    transition: opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
}
.tl-bubble-toolbar:after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--tl-bubble-bg) transparent transparent transparent;
}
.tl-bubble-btn {
    background: transparent;
    border: none;
    color: var(--tl-bubble-fg);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tl-font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s ease;
}
.tl-bubble-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}
.tl-bubble-btn.active {
    background: rgba(255, 255, 255, 0.3);
}
.tl-bubble-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* 气泡链接输入弹窗 */
.tl-bubble-link-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
}
.tl-bubble-link-input {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    color: #fff;
    font-family: var(--tl-font-sans);
    font-size: 13px;
    padding: 4px 8px;
    outline: none;
    width: 200px;
}
.tl-bubble-link-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* ── 空行左侧 "+" 快捷插入菜单 (Block Action Menu) ── */
.tl-block-action {
    position: absolute;
    left: -42px;
    transform: translateY(-2px);
    z-index: 200;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tl-block-plus-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #aeb7c0;
    background: #fff;
    color: #79828b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tl-block-plus-btn:hover {
    border-color: var(--tl-fg);
    color: var(--tl-fg);
    transform: scale(1.08);
}
.tl-block-menu {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 4px;
    gap: 4px;
}
.tl-block-menu-item {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--tl-fg);
    font-family: var(--tl-font-sans);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.12s ease;
}
.tl-block-menu-item:hover {
    background: #f0f2f5;
}

/* ── 文件上传面板 / 抽屉 ── */
.tl-upload-panel {
    background: #fafbfc;
    border: 1px solid var(--tl-border);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    font-family: var(--tl-font-sans);
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.tl-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    color: var(--tl-fg-muted);
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tl-dropzone:hover, .tl-dropzone.dragging {
    border-color: var(--tl-link);
    background: #f0f7fd;
}
.tl-file-input { display: none; }
.tl-dropzone .tl-dropzone-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--tl-fg);
    margin-bottom: 6px;
}
.tl-dropzone .tl-dropzone-hint {
    font-size: 13px;
    color: var(--tl-fg-muted);
}

.tl-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 16px;
}
.tl-progress-fill {
    height: 100%;
    background: var(--tl-link);
    width: 0%;
    transition: width 0.1s linear;
}

/* ── Telegraph 结果展示卡片 ── */
.tl-result-card {
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.tl-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f5;
    font-family: var(--tl-font-sans);
    font-size: 14px;
}
.tl-result-row:last-child { border-bottom: none; }
.tl-result-label {
    color: var(--tl-fg-muted);
    font-size: 13px;
    flex: 0 0 80px;
}
.tl-result-val {
    flex: 1;
    word-break: break-all;
    margin-right: 12px;
}
.tl-btn-copy {
    background: #f0f2f5;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: var(--tl-font-sans);
    transition: background 0.12s ease;
}
.tl-btn-copy:hover {
    background: #e4e7eb;
}

/* ── Toast 提示通知 ── */
.tl-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(34, 34, 34, 0.95);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 8px 18px;
    border-radius: 999px;
    font-family: var(--tl-font-sans);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9999;
}
.tl-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.tl-toast.error {
    background: #cf222e;
}
.tl-toast.success {
    background: #2ea44f;
}

/* ── 文件分享页面专属样式 (`/f/{slug}`) ── */
.tl-file-card {
    text-align: center;
    padding: 60px 20px 40px;
    font-family: var(--tl-font-sans);
}
.tl-file-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    color: var(--tl-link);
}
.tl-file-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--tl-fg);
    margin-bottom: 10px;
    word-break: break-word;
}
.tl-file-details {
    color: var(--tl-fg-muted);
    font-size: 15px;
    margin-bottom: 28px;
}
.tl-file-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
}
.tl-file-actions .tl-btn-pill {
    padding: 10px 28px;
    font-size: 16px;
}

/* ── 后台管理页面极简样式 (`/admin`) ── */
.tl-admin-panel {
    font-family: var(--tl-font-sans);
}
.tl-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--tl-border);
    padding-bottom: 16px;
}
.tl-admin-title {
    font-size: 24px;
    font-weight: 700;
}
.tl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 16px;
}
.tl-table th, .tl-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf0f2;
    text-align: left;
}
.tl-table th {
    color: var(--tl-fg-muted);
    font-weight: 600;
    font-size: 13px;
}
.tl-table tr:hover td {
    background: #fafbfc;
}
.tl-cell-title {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 登录页面极简无框风格 (对齐 Telegraph 极简美学) ── */
.tl-login-container {
    max-width: 360px;
    margin: 60px auto 100px;
    font-family: var(--tl-font-sans);
}

.tl-login-title {
    font-family: var(--tl-font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--tl-fg);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.tl-login-subtitle {
    font-size: 14px;
    color: var(--tl-fg-muted);
    margin-bottom: 36px;
}

.tl-login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tl-login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tl-login-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--tl-border);
    padding: 10px 0;
    font-family: var(--tl-font-sans);
    font-size: 16px;
    color: var(--tl-fg);
    outline: none;
    border-radius: 0;
    transition: border-color 0.15s ease;
}

.tl-login-input:focus {
    border-bottom-color: var(--tl-fg);
}

.tl-login-input::placeholder {
    color: var(--tl-fg-light);
    font-size: 15px;
}

.tl-login-error-text {
    color: var(--tl-danger);
    font-size: 13px;
    margin-top: 4px;
}

.tl-login-submit {
    margin-top: 16px;
    padding: 10px 24px;
    font-size: 15px;
    align-self: flex-start;
}

/* ── 移动端屏幕适配 ── */
@media (max-width: 768px) {
    .tl-container {
        padding: 24px 16px 60px;
    }
    .tl-title-input {
        font-size: 28px;
    }
    .tl-block-action {
        left: 0;
        top: -36px;
        position: relative;
        margin-bottom: 8px;
    }
    .tl-bubble-toolbar {
        max-width: 95vw;
        overflow-x: auto;
    }
}
