:root {
  --bg: #f8f9fc; --card: #fff; --text: #0f0f14; --text2: #4b5563; --muted: #8b8b95;
  --border: #e8e8ec; --primary: #6366f1; --soft: rgba(99, 102, 241, .12);
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6 50%, #ec4899);
  --primary-rgb: 99, 102, 241;
}
[data-theme="dark"] {
  --bg: #0b0c10; --card: #15161c; --text: #f3f4f6; --text2: #9ca3af; --muted: #6b7280;
  --border: #2d2f38; --primary: #818cf8; --soft: rgba(129, 140, 248, .15);
  --grad: linear-gradient(135deg, #4f46e5, #7c3aed 50%, #db2777);
}

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

/* 🚨 核心修复：强制始终显示纵向滚动条，防止页面切换时宽度突变导致抖动 */
html, body {
  overflow-x: hidden;
  overflow-y: scroll;
  width: 100%;
  max-width: 100vw;
  transition: background 0.3s, color 0.3s;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65;
}

/* 导航栏 */
.navbar { position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, .85); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
[data-theme="dark"] .navbar { background: rgba(11, 12, 16, .85); }
.ni { max-width: 1140px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 24px; }
.logo { font-size: 17px; font-weight: 700; cursor: pointer; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nl { display: flex; gap: 4px; }
.nl a { padding: 8px 14px; border-radius: 9px; color: var(--text2); font-size: 14px; text-decoration: none; cursor: pointer; font-weight: 500; transition: all .2s; }
.nl a:hover { background: var(--soft); color: var(--primary); }
.nl a.on { background: var(--grad); color: #fff; }
.nav-actions { margin-left: auto; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.icon-btn:hover { background: var(--soft); border-color: var(--primary); }

#app { max-width: 1140px; margin: 0 auto; padding: 48px 24px 80px; min-height: 400px; }

/* 卡片与首页 */
.hero { background: var(--grad); border-radius: 28px; padding: 80px 48px; color: #fff; text-align: center; margin-bottom: 40px; box-shadow: 0 20px 60px rgba(99, 102, 241, .3); }
.hero h1 { font-size: 40px; font-weight: 800; margin-bottom: 16px; }
.hero p { font-size: 17px; opacity: .95; }
.hs { display: flex; justify-content: center; gap: 40px; margin-top: 32px; }
.hs>div { text-align: center; }
.hs b { font-size: 28px; font-weight: 700; display: block; }
.hs span { font-size: 12px; opacity: .85; letter-spacing: 1px; }
.search-box { margin-bottom: 32px; position: relative; }
.search-box input { width: 100%; padding: 16px 24px; border-radius: 50px; border: 1px solid var(--border); background: var(--card); font-size: 16px; color: var(--text); box-shadow: 0 4px 20px rgba(0, 0, 0, .04); transition: all .3s; font-family: inherit; }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 8px 30px rgba(99, 102, 241, .15); }
.hitokoto-box { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; padding-bottom: 20px; font-style: italic; min-height: 33px; }

.pg { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.pc { background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; cursor: pointer; transition: transform .3s, box-shadow .3s, border-color .3s; }
.pc:hover { transform: translateY(-6px); box-shadow: 0 16px 48px rgba(99, 102, 241, .18); border-color: var(--primary); }
.pcv { width: 100%; aspect-ratio: 16/9; background-size: cover; background-position: center; background-repeat: no-repeat; transition: all 0.3s; }
.pb { padding: 20px 22px 24px; }
.pt { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.pm { font-size: 14px; color: var(--text2); margin-bottom: 16px; }
.pmt { font-size: 12px; color: var(--muted); }
.ptg { padding: 4px 10px; background: var(--soft); border-radius: 20px; font-size: 11.5px; color: var(--primary); font-weight: 600; margin-right: 4px; }

.st { font-size: 20px; font-weight: 700; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.st::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.ld { display: flex; justify-content: center; align-items: center; min-height: 300px; color: var(--muted); }

/* 关于页 & 统计 */
.ab { text-align: center; padding: 40px; }
.ab h1 { margin: 20px 0; font-size: 30px; }
.stats-board { display: flex; justify-content: center; gap: 40px; margin: 30px auto; background: var(--card); padding: 24px; border-radius: 20px; border: 1px solid var(--border); max-width: 600px; box-shadow: 0 4px 20px rgba(0, 0, 0, .04); }
.stat-item { text-align: center; }
.stat-item b { display: block; font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat-item span { font-size: 13px; color: var(--muted); }
.abs { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 26px 30px; margin: 16px auto 0; max-width: 600px; text-align: left; }
.abs h3 { color: var(--primary); margin-bottom: 14px; font-size: 15.5px; }
.abs ul { list-style: none; padding: 0; }
.abs li { padding: 6px 0; color: var(--text2); }

/* 文章详情 */
.art { max-width: 760px; margin: 0 auto; }
.art h1 { font-size: 36px; font-weight: 800; margin-bottom: 20px; line-height: 1.25; }
.art .meta { color: var(--muted); font-size: 13.5px; margin-bottom: 32px; }
.art .body { font-size: 16.5px; line-height: 1.8; }
.art .body h1, .art .body h2, .art .body h3 { margin: 32px 0 16px; font-weight: 700; }
.art .body h2 { font-size: 22px; padding-left: 14px; border-left: 4px solid var(--primary); }
.art .body h3 { font-size: 18px; }
.art .body p { margin: 14px 0; }
.art .body ul, .art .body ol { margin: 14px 0 14px 24px; }
.art .body blockquote { border-left: 4px solid var(--primary); padding: 12px 20px; margin: 20px 0; background: var(--soft); border-radius: 0 10px 10px 0; color: var(--text2); }
.art .body code { background: rgba(127, 127, 127, .15); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.art .body pre { background: #0d1117; color: #c9d1d9; padding: 16px; border-radius: 12px; overflow-x: auto; margin: 16px 0; position: relative; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.art .body pre code { background: none; color: inherit; font-family: 'Fira Code', 'Consolas', monospace !important; font-size: 14px; line-height: 1.6; }
.art .body img { max-width: 100%; border-radius: 12px; margin: 16px 0; transition: transform .2s; }
.art .body img:hover { transform: scale(1.02); }
.art .body table { border-collapse: collapse; margin: 16px 0; width: 100%; }
.art .body th, .art .body td { border: 1px solid var(--border); padding: 8px 12px; }
.art .body th { background: var(--soft); }

/* 标签与侧边栏 */
.tg { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.tgc { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; transition: all .25s; }
.tgc:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: 0 16px 48px rgba(99, 102, 241, .18); }
.tgc .n { font-size: 16px; font-weight: 700; }
.tgc .c { font-size: 12px; color: var(--muted); margin-top: 8px; }
.home-layout { display: flex; gap: 30px; align-items: flex-start; }
.home-main { flex: 1; min-width: 0; }
.home-sidebar { width: 300px; flex-shrink: 0; }
.sidebar-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 24px; position: sticky; top: 88px; margin-bottom: 20px; }
.sidebar-card .st { margin-bottom: 20px; font-size: 18px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-item { padding: 6px 12px; background: var(--soft); border-radius: 8px; font-size: 13px; color: var(--primary); cursor: pointer; transition: all 0.2s; font-weight: 500; }
.cloud-item:hover { background: var(--grad); color: #fff; }
.hot-list { list-style: none; padding: 0; margin: 0; }
.hot-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.hot-list li:last-child { border-bottom: none; }
.hot-list a { color: var(--text); text-decoration: none; font-size: 14.5px; font-weight: 500; line-height: 1.4; transition: color .2s; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hot-list a:hover { color: var(--primary); }
.hot-rank { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.hot-list li:nth-child(1) .hot-rank { background: #ef4444; color: #fff; }
.hot-list li:nth-child(2) .hot-rank { background: #f59e0b; color: #fff; }
.hot-list li:nth-child(3) .hot-rank { background: #3b82f6; color: #fff; }

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 40px; margin-bottom: 20px; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); color: var(--text2); font-size: 14px; text-decoration: none; transition: all .2s; cursor: pointer; }
.page-btn:hover:not(.disabled):not(.active) { border-color: var(--primary); color: var(--primary); background: var(--soft); }
.page-btn.active { background: var(--grad); color: #fff; border-color: transparent; cursor: default; }
.page-btn.disabled { opacity: .5; cursor: not-allowed; background: var(--bg); }

/* 灯箱 */
.lightbox { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.85); display: flex; justify-content: center; align-items: center; z-index: 99999; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(5px); }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); object-fit: contain; cursor: zoom-out; }

/* 聊天面板 */
.chat-fab { position: fixed; right: 28px; bottom: 28px; width: 60px; height: 60px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 28px; cursor: pointer; box-shadow: 0 12px 40px rgba(99, 102, 241, .45); z-index: 90; user-select: none; transition: all .3s; animation: fabPulse 3s infinite; }
.chat-fab:hover { transform: scale(1.12) rotate(10deg); animation-play-state: paused; }
.chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(.3); }
@keyframes fabPulse { 0%, 100% { box-shadow: 0 12px 40px rgba(99, 102, 241, .45); } 50% { box-shadow: 0 12px 50px rgba(99, 102, 241, .75); } }
.chat-panel { position: fixed; right: 28px; bottom: 28px; width: 400px; height: 620px; max-height: calc(100vh - 56px); background: var(--card); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 24px 80px rgba(0, 0, 0, .2); display: flex; flex-direction: column; z-index: 95; overflow: hidden; opacity: 0; pointer-events: none; transform: translateY(24px) scale(.94); transition: all .3s cubic-bezier(.4, 0, .2, 1); }
.chat-panel.open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.chat-header { background: var(--grad); color: #fff; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; }
.chat-title { display: flex; align-items: center; gap: 12px; }
.chat-avatar { width: 40px; height: 40px; background: rgba(255, 255, 255, .25); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.chat-name { font-size: 16px; font-weight: 700; }
.chat-status { font-size: 11.5px; opacity: .9; }
.chat-actions { display: flex; gap: 6px; }
.chat-actions button { background: rgba(255, 255, 255, .18); border: none; color: #fff; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 14px; transition: all .2s; }
.chat-actions button:hover { background: rgba(255, 255, 255, .35); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); }
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-msg { display: flex; gap: 10px; animation: cfade .3s; }
@keyframes cfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg .avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.chat-msg.bot .avatar { background: var(--soft); border: 1px solid var(--border); }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .avatar { background: var(--grad); color: #fff; }
.chat-msg .bubble { padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.65; max-width: calc(100% - 44px); word-break: break-word; }
.chat-msg.bot .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.user .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg .bubble p { margin: 4px 0; }
.chat-msg .bubble code { background: rgba(127, 127, 127, .15); padding: 1px 6px; border-radius: 4px; font-size: .85em; }
.chat-msg .bubble pre { background: #0d1117; color: #c9d1d9; padding: 10px; border-radius: 8px; overflow-x: auto; margin: 8px 0; font-size: .82em; }
.chat-input-area { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--card); }
.chat-input-area input { flex: 1; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 14px; font-size: 13.5px; outline: none; background: var(--bg); color: var(--text); font-family: inherit; }
.chat-input-area input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.chat-input-area button { padding: 0 20px; background: var(--grad); color: #fff; border: none; border-radius: 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.voice-btn { background: var(--bg); border: 1.5px solid var(--border); border-radius: 50%; width: 44px; height: 44px; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; color: var(--text); }
.voice-btn.recording { background: #ef4444; border-color: #ef4444; color: white; animation: voicePulse 1.2s infinite; }
@keyframes voicePulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

/* 返回顶部 */
#back-to-top { position: fixed; right: 33px; bottom: 105px; width: 50px; height: 50px; border-radius: 50%; background: var(--grad); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); z-index: 90; opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { transform: translateY(-4px) scale(1.08); box-shadow: 0 8px 20px rgba(99, 102, 241, 0.6); }

/* 时间轴 */
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding: 20px 0; }
.timeline::before { content: ''; position: absolute; top: 0; bottom: 0; left: 20px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 60px; margin-bottom: 30px; }
.timeline-dot { position: absolute; left: 14px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--primary); }
.timeline-date { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.timeline-content a { font-size: 16px; color: var(--text); text-decoration: none; font-weight: 600; transition: color .2s; display: inline-block; }
.timeline-content a:hover { color: var(--primary); transform: translateX(4px); }

/* TOC 目录 */
.toc-container { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 30px; }
.toc-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; color: var(--text); }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item { margin: 8px 0; }
.toc-item a { color: var(--text2); text-decoration: none; font-size: 14px; transition: color 0.2s; }
.toc-item a:hover { color: var(--primary); }
.toc-item.h3 { padding-left: 20px; }

/* 评论区 */
.comments-section { margin-top: 60px; padding-top: 30px; border-top: 1px dashed var(--border); max-width: 760px; margin-left: auto; margin-right: auto; }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.comment-form input, .comment-form textarea { padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-family: inherit; resize: vertical; }
.comment-form textarea { min-height: 100px; }
.comment-form button { align-self: flex-start; padding: 10px 24px; background: var(--grad); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item { background: var(--card); padding: 16px; border-radius: 12px; border: 1px solid var(--border); }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.comment-name { font-weight: 600; color: var(--primary); }
.comment-time { font-size: 12px; color: var(--muted); }
.comment-content { font-size: 14.5px; color: var(--text); line-height: 1.6; }

/* 全局搜索框 */
.search-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 10000; display: flex; justify-content: center; align-items: flex-start; padding-top: 15vh; opacity: 0; visibility: hidden; transition: all 0.2s; }
.search-modal.show { opacity: 1; visibility: visible; }
.search-modal-content { width: 100%; max-width: 600px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; transform: translateY(-20px) scale(0.98); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.search-modal.show .search-modal-content { transform: translateY(0) scale(1); }
.search-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.search-header input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 16px; font-family: inherit; }
.search-results { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.search-results li { padding: 12px 20px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.search-results li:last-child { border-bottom: none; }
.search-results li:hover, .search-results li.active { background: var(--soft); }
.search-results .res-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.search-results .res-meta { font-size: 12px; color: var(--muted); }

/* AI 弹窗 */
.ai-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 10000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: all 0.3s; }
.ai-modal.show { opacity: 1; pointer-events: auto; }
.ai-modal-content { background: var(--card); width: 90%; max-width: 600px; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.3); transform: translateY(20px); transition: all 0.3s; display: flex; flex-direction: column; }
.ai-modal.show .ai-modal-content { transform: translateY(0); }
.ai-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 16px; color: var(--primary); }
.ai-modal-body { padding: 24px 20px; font-size: 15px; line-height: 1.8; color: var(--text); max-height: 50vh; overflow-y: auto; }
.ai-modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); text-align: right; }
.ai-modal-footer .btn-close { padding: 8px 24px; background: var(--grad); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; }

/* 按钮样式 */
.ai-btn, .poster-btn, .like-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 14px; margin-top: 20px; margin-right: 10px; color: var(--text2); transition: all 0.2s; }
.ai-btn:hover, .poster-btn:hover { background: var(--soft); color: var(--primary); border-color: var(--primary); }
.like-btn:hover { border-color: #ec4899; color: #ec4899; background: var(--soft); }
.like-btn.liked { background: #fce7f3; border-color: #ec4899; color: #ec4899; pointer-events: none; }
[data-theme="dark"] .like-btn.liked { background: rgba(236, 72, 153, 0.2); }

.heart-float { position: fixed; pointer-events: none; font-size: 24px; animation: floatUp 1s ease-out forwards; z-index: 9999; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-80px) scale(1.5); } }

/* 代码折叠 */
.art .body pre.collapsed { max-height: 350px; overflow: hidden; position: relative; }
.art .body pre.collapsed::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 80px; background: linear-gradient(transparent, #0d1117); }
.code-expand-btn { display: block; width: 100%; text-align: center; padding: 10px; background: rgba(255,255,255,0.05); color: #c9d1d9; border: none; border-top: 1px solid #333; cursor: pointer; font-size: 13px; transition: background .2s; }
.code-expand-btn:hover { background: rgba(255,255,255,0.1); }

.private-box { max-width: 400px; margin: 60px auto; padding: 30px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.private-box input { width: 100%; padding: 12px; margin: 20px 0; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 16px; text-align: center; }
.private-box button { width: 100%; padding: 12px; background: var(--grad); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; }
#admin-chart { width: 100%; height: 300px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 40px; }

@media(max-width:768px) {
  .home-layout { flex-direction: column; }
  .home-sidebar { width: 100%; }
  .sidebar-card { position: static; }
  .ni { padding: 0 16px; gap: 12px; }
  .nl a { padding: 6px 10px; font-size: 13px; }
  #app { padding: 24px 16px 60px; }
  .hero { padding: 48px 24px; border-radius: 20px; }
  .hero h1 { font-size: 26px; }
  .pg { grid-template-columns: 1fr; }
  .chat-fab { right: 16px; bottom: 16px; width: 54px; height: 54px; font-size: 24px; }
  .chat-panel { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; max-height: 100vh; border-radius: 0; z-index: 9999; }
  .chat-header { position: sticky; top: 0; z-index: 10000; }
  .chat-actions button { display: flex !important; visibility: visible !important; opacity: 1 !important; justify-content: center; align-items: center; }
  #back-to-top { right: 19px; bottom: 85px; width: 48px; height: 48px; }
  .aplayer.aplayer-fixed.mini { bottom: 80px !important; }
}

/* 🚨 滚动动画 */
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* ================= 🚨 新增：圆形阅读进度球 ================= */
#read-progress-ball {
  position: fixed;
  right: 33px;
  bottom: 170px; /* 在返回顶部按钮的上方 */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 89;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  /* 利用 conic-gradient 实现进度环，初始 0% */
  background-image: conic-gradient(var(--primary) 0%, var(--border) 0%);
}
#read-progress-ball.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#read-progress-ball::before {
  content: '';
  position: absolute;
  width: 42px;
  height: 42px;
  background: var(--card);
  border-radius: 50%;
}
#read-progress-text {
  position: relative;
  font-size: 12px;
  font-weight: bold;
  color: var(--primary);
}
@media(max-width: 768px) {
  #read-progress-ball { right: 19px; bottom: 145px; width: 42px; height: 42px; }
  #read-progress-ball::before { width: 36px; height: 36px; }
}

/* ================= 🚨 新增：轻量级 Toast 提示 ================= */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 100000;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================= 🚨 新增：代码沙盒 ================= */
.code-run-btn {
  position: absolute;
  top: 10px;
  right: 60px; /* 在复制按钮的左边 */
  background: #238636;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  z-index: 10;
}
.code-run-btn:hover { background: #2ea043; }
.sandbox-iframe {
  width: 100%;
  height: 300px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  margin-top: -16px;
  margin-bottom: 20px;
  display: none;
}
.sandbox-iframe.active { display: block; }

/* 代码块 macOS 风格圆点 */
.art .body pre {
  padding-top: 36px !important;
}
.art .body pre::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f;
  z-index: 10;
}
/* 确保复制和运行按钮不被圆点挡住 */
.code-copy-btn, .code-run-btn {
  top: 8px !important; 
}

/* ================= 🚨 右下角元素防遮挡布局 ================= */
.chat-fab {
  bottom: 30px !important;
  right: 30px !important;
}
#read-progress-ball {
  bottom: 110px !important;
  right: 35px !important;
}
#back-to-top {
  bottom: 190px !important;
  right: 30px !important;
}
@media (max-width: 768px) {
  .chat-fab { bottom: 20px !important; right: 20px !important; }
  #read-progress-ball { bottom: 90px !important; right: 25px !important; }
  #back-to-top { bottom: 160px !important; right: 20px !important; }
}

/* 🚨 卡片悬浮微动效 */
.pc {
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease !important;
}
.pc:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18) !important;
}

/* 🚨 增强版图片灯箱 */
.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 9999; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; object-fit: contain; }

/* 🚨 防止悬浮按钮重叠 */
.chat-fab { bottom: 30px !important; right: 30px !important; }
#read-progress-ball { bottom: 110px !important; right: 35px !important; }
#back-to-top { bottom: 190px !important; right: 30px !important; }
@media (max-width: 768px) {
  .chat-fab { bottom: 20px !important; right: 20px !important; }
  #read-progress-ball { bottom: 90px !important; right: 25px !important; }
  #back-to-top { bottom: 160px !important; right: 20px !important; }
}

/* EasyMDE 暗黑模式适配 */
[data-theme="dark"] .EasyMDEContainer .CodeMirror { background: #1e1e24; color: #e2e8f0; border-color: #333; }
[data-theme="dark"] .editor-toolbar { background: #1e1e24; border-color: #333; }
[data-theme="dark"] .editor-toolbar button { color: #e2e8f0 !important; }
[data-theme="dark"] .editor-toolbar button:hover { background: #333; }