:root { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; color: #172033; background: #f4f7fb; }
* { box-sizing: border-box; }
body { margin: 0; }
.topbar { padding: 34px clamp(22px, 5vw, 72px) 28px; color: #fff; background: linear-gradient(125deg, #172554, #2563eb 60%, #38bdf8); display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.eyebrow { font-size: 12px; letter-spacing: .18em; opacity: .75; }
h1 { margin: 8px 0 6px; font-size: clamp(28px, 4vw, 44px); }
.subtitle { margin: 0; color: #dbeafe; }
#local-mode { margin-top: 16px; }
#choose-folder { border: 0; border-radius: 9px; padding: 10px 14px; color: #1e3a8a; background: #fff; cursor: pointer; font: inherit; }
.stats { display: flex; gap: 18px; font-size: 14px; color: #e0f2fe; }
.layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) minmax(170px, 210px); grid-template-areas: "sidebar reader outline"; align-items: start; min-height: calc(100vh - 170px); max-width: none; margin: 0 auto; }
.sidebar { grid-area: sidebar; position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; border-right: 1px solid #dbe3ef; background: #fff; padding: 20px; }
.sidebar-heading { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.sidebar-title { margin: 0; color: #172033; font-size: 17px; line-height: 1.4; }
.sidebar-toggle { display: grid; flex: none; min-width: 30px; height: 30px; padding: 0 8px; place-items: center; border: 1px solid #dbe3ef; border-radius: 8px; color: #334155; background: #fff; cursor: pointer; font: 13px/1 "Segoe UI", "Microsoft YaHei", sans-serif; }
.sidebar-toggle:hover { color: #1d4ed8; background: #eff6ff; }
.toolbar { display: grid; flex: none; gap: 10px; background: #fff; padding-bottom: 12px; z-index: 2; }
input, select { width: 100%; border: 1px solid #d3dcea; border-radius: 10px; padding: 11px 12px; font: inherit; color: inherit; background: #f8fafc; }
.essay-list { display: grid; flex: 1; min-height: 0; gap: 9px; align-content: start; overflow-y: auto; overscroll-behavior: contain; }
.essay-card { border: 1px solid #e1e8f2; border-radius: 12px; padding: 13px; cursor: pointer; background: #fff; transition: .18s; }
.essay-card:hover, .essay-card.active { border-color: #60a5fa; background: #eff6ff; transform: translateY(-1px); }
.essay-card h3 { font-size: 15px; line-height: 1.5; margin: 0 0 8px; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 11px; color: #1d4ed8; background: #dbeafe; }
.reader { grid-area: reader; min-width: 0; padding: clamp(24px, 4vw, 64px); width: 100%; }
.article-outline { grid-area: outline; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px 14px 24px 0; }
.article-outline h2 { margin: 0 0 14px; color: #172033; font-size: 15px; line-height: 1.5; }
.article-outline nav { display: grid; gap: 4px; border-left: 1px solid #dbe3ef; }
.article-outline a { padding: 7px 10px; color: #526078; font-size: 13px; line-height: 1.55; text-decoration: none; }
.article-outline a:hover, .article-outline a:focus-visible { color: #1d4ed8; background: #eff6ff; outline: none; }
.markdown-content p[id] { scroll-margin-top: 24px; }
.layout.sidebar-collapsed { grid-template-columns: 54px minmax(0, 1fr) minmax(170px, 210px); }
.sidebar-collapsed .sidebar { align-items: center; padding: 12px 8px; }
.sidebar-collapsed .sidebar-heading { justify-content: center; margin: 0; }
.sidebar-collapsed .sidebar-title, .sidebar-collapsed .toolbar, .sidebar-collapsed .essay-list { display: none; }
.reader-inner { background: #fff; border: 1px solid #e1e8f2; border-radius: 18px; padding: clamp(24px, 5vw, 56px); box-shadow: 0 10px 30px #1e3a8a0d; }
.reader h2 { margin: 0 0 12px; font-size: clamp(24px, 3vw, 36px); line-height: 1.35; }
.reader h3 { margin-top: 30px; color: #1d4ed8; }
.abstract { border-left: 4px solid #60a5fa; background: #eff6ff; padding: 16px 18px; border-radius: 0 10px 10px 0; line-height: 1.9; }
.body p { line-height: 2; text-align: justify; margin: 18px 0; }
.markdown-content { color: #1e293b; line-height: 2; }
.markdown-content p { margin: 18px 0; text-align: justify; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4 { color: #1d4ed8; line-height: 1.5; margin: 30px 0 14px; }
.markdown-content h1 { font-size: 28px; }
.markdown-content h2 { font-size: 24px; }
.markdown-content h3 { font-size: 20px; }
.markdown-content ul, .markdown-content ol { margin: 16px 0; padding-left: 28px; }
.markdown-content li { margin: 8px 0; }
.markdown-content .table-wrap { max-width: 100%; margin: 22px 0; overflow-x: auto; border: 1px solid #dbe3ef; border-radius: 8px; -webkit-overflow-scrolling: touch; }
.markdown-content table { width: 100%; min-width: 760px; border-collapse: collapse; line-height: 1.65; font-size: 14px; }
.markdown-content th, .markdown-content td { min-width: 120px; padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.markdown-content th { color: #172554; background: #f1f5f9; font-weight: 650; }
.markdown-content tbody tr:last-child td { border-bottom: 0; }
.markdown-content tbody tr:nth-child(even) { background: #f8fafc; }
.markdown-content blockquote { margin: 18px 0; padding: 10px 16px; border-left: 4px solid #60a5fa; background: #eff6ff; color: #334155; }
.markdown-content hr { border: 0; border-top: 1px solid #dbe3ef; margin: 28px 0; }
.markdown-content code { padding: 2px 5px; border-radius: 5px; background: #eef2ff; color: #4338ca; font: 0.92em Consolas, monospace; }
.markdown-content .code-block { margin: 18px 0; padding: 18px; overflow: auto; border-radius: 10px; background: #0f172a; color: #e2e8f0; white-space: pre-wrap; word-break: break-word; font: 14px/1.7 Consolas, monospace; }
.markdown-content .code-block code { padding: 0; background: transparent; color: inherit; }
.markdown-content a { color: #2563eb; }
.meta { color: #64748b; font-size: 13px; margin-bottom: 26px; }
.empty { color: #64748b; padding: 24px 8px; text-align: center; }
@media (max-width: 1100px) { .layout, .layout.sidebar-collapsed { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); grid-template-areas: "sidebar outline" "sidebar reader"; } .layout.sidebar-collapsed { grid-template-columns: 54px minmax(0, 1fr); } .article-outline { position: sticky; top: 0; max-height: none; padding: 14px 20px; border-bottom: 1px solid #dbe3ef; background: #fff; z-index: 3; } .article-outline nav { display: flex; gap: 4px; overflow-x: auto; border: 0; } .article-outline a { flex: none; white-space: nowrap; } }
@media (max-width: 800px) { .topbar { display: block; } .stats { margin-top: 18px; } .layout, .layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sidebar" "outline" "reader"; } .sidebar, .sidebar-collapsed .sidebar { position: static; height: min(45vh, 380px); min-height: 240px; border-right: 0; border-bottom: 1px solid #dbe3ef; padding: 20px; align-items: stretch; } .sidebar-collapsed .sidebar { height: auto; min-height: 0; padding: 8px 12px; } .sidebar-collapsed .sidebar-heading { justify-content: flex-end; } .sidebar-toggle { position: fixed; right: 14px; bottom: 14px; z-index: 20; min-width: 88px; height: 44px; color: #fff; border-color: #2563eb; background: #2563eb; font-size: 14px; box-shadow: 0 5px 16px #0f172a33; } .essay-list { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); } .reader { padding: 20px 12px; } .article-outline { position: sticky; top: 0; padding: 12px; } }
.touch-layout .layout, .touch-layout .layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sidebar" "outline" "reader"; }
.touch-layout .sidebar, .touch-layout .sidebar-collapsed .sidebar { position: static; height: min(45vh, 380px); min-height: 240px; border-right: 0; border-bottom: 1px solid #dbe3ef; padding: 20px; align-items: stretch; }
.touch-layout .sidebar-collapsed .sidebar { height: auto; min-height: 0; padding: 8px 12px; }
.touch-layout .sidebar-collapsed .sidebar-heading { justify-content: flex-end; }
.touch-layout .sidebar-toggle { position: fixed; right: 14px; bottom: 14px; z-index: 20; min-width: 88px; height: 44px; color: #fff; border-color: #2563eb; background: #2563eb; font-size: 14px; box-shadow: 0 5px 16px #0f172a33; }
.touch-layout .essay-list { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.touch-layout .reader { padding: 20px 12px; }
.touch-layout .article-outline { position: sticky; top: 0; padding: 12px; }
