@media (max-width:768px){
  main .bg-white { padding-left:10px!important; padding-right:10px!important; }
}

/* ===================================
   标题样式 h2 / h3 / h4
=================================== */
.markdown-body h2 {
  font-size: 22px !important;
  font-weight: 700 !important;
  margin: 28px 0 14px !important;
  padding-left: 12px !important;
  border-left: 4px solid #E60012 !important;
  color: #1a1a1a !important;
  line-height: 1.5 !important;
}

.markdown-body h3 {
  font-size: 20px !important;
  font-weight: 600 !important;
  margin: 22px 0 10px !important;
  padding-left: 12px !important;
  border-left: 3px solid #f97316 !important;
  color: #1e293b !important;
  line-height: 1.5 !important;
}

.markdown-body h4 {
  font-size: 18px !important;
  font-weight: 600 !important;
  margin: 16px 0 8px !important;
  padding-left: 12px !important;
  border-left: 3px solid #64748b !important;
  color: #475569 !important;
  line-height: 1.5 !important;
}

.markdown-body p {
  margin: 0 0 16px !important;
  line-height: 1.85 !important;
  font-size: 16px !important;
}

.markdown-body img {
  max-width:100%!important;
  height:auto!important;
  display:block;
  margin:1.2em auto;
  border-radius:0!important;
}
@media (max-width:768px){
  .markdown-body img{ cursor:pointer; }
}

/* ===================================
   TOC 右侧悬浮目录 + 默认收缩为一个点 + 点击展开
=================================== */
.toc-float {
  position: fixed;
  top: 100px;
  right: 10px;
  z-index: 99;
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
.toc-btn {
  width: auto;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(230, 0, 18, 0.15);
  font-size: 14px;
  font-weight: 600;
  color: #E60012;
}
.toc-btn:hover {
  background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
  transform: scale(1.05);
}
.toc-btn span {
  font-size: 14px;
  font-weight: 600;
  color: #E60012;
}
.toc-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.3s ease;
}
.toc-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.toc-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(230, 0, 18, 0.2);
  border: 1px solid rgba(230, 0, 18, 0.1);
  overflow: hidden;
}
.toc-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  font-weight: 700;
  font-size: 15px;
  color: #E60012;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(230, 0, 18, 0.08);
  transition: background 0.3s ease;
}
.toc-header:hover {
  background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
}
.toc-header i {
  font-size: 14px;
  transition: transform 0.3s ease;
}
.toc-header i.open {
  transform: rotate(180deg);
}
.toc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.toc-body.show {
  max-height: 65vh;
  padding: 14px 16px;
  overflow-y: auto;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.toc-list li { margin:0; padding:0; }
.toc-link-h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.toc-link-h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: #E60012;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.toc-link-h2:hover {
  background: linear-gradient(90deg, rgba(230, 0, 18, 0.08) 0%, transparent 100%);
  color: #E60012;
  padding-left: 16px;
}
.toc-link-h2:hover::before {
  opacity: 1;
}
.toc-link-h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 24px;
  font-size: 13px;
  color: #64748b;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
}
.toc-link-h3::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 50%;
  transition: all 0.25s ease;
}
.toc-link-h3:hover {
  background: linear-gradient(90deg, rgba(22, 93, 255, 0.06) 0%, transparent 100%);
  color: #165DFF;
  padding-left: 28px;
}
.toc-link-h3:hover::before {
  background: #165DFF;
}

/* ===================================
   文章内目录样式（隐藏，保留浮动目录）
=================================== */
.article-toc {
  display: none;
}

/* 小屏幕自动隐藏右侧目录 */
@media (max-width: 1200px) {
  .toc-float { display: none; }
}

/* 表格修复：桌面版永远100%宽度，整齐美观 */
.markdown-body table.border-collapse {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  display: table !important;
  overflow-x: visible !important;
  border-collapse: collapse !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
  background: #fff !important;
  margin: 1.4em 0 !important;
}

/* 手机版才横向滚动 */
@media (max-width: 768px) {
  .markdown-body table.border-collapse {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

.markdown-body table.border-collapse th {
  background: #f8fafc !important;
  font-weight: 600 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.markdown-body table.border-collapse th,
.markdown-body table.border-collapse td {
  padding: 12px 14px !important;
  border: 1px solid #e2e8f0 !important;
  min-width: 100px !important;
  max-width: 220px !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.markdown-body table.border-collapse tbody tr:nth-child(even) {
  background-color: #fafbfc !important;
}

.markdown-body table.border-collapse tbody tr:hover {
  background-color: #fff1f2 !important;
}

/* ===================================
   图片预览
=================================== */
#imgViewer{
  position:fixed;
  inset:0;
  background:#000;
  z-index:9999;
  display:none;
}
#imgViewer.show{ display:block; }
.viewer-wrap{
  width:100%;
  height:100%;
  display:flex;
  padding:80px 0;
  box-sizing:border-box;
}
.viewer-slide{
  flex:0 0 100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.viewer-slide img{
  max-width:94%;
  max-height:100%;
  object-fit:contain;
}
.viewer-count{
  position:fixed;
  top:40px;
  left:50%;
  transform:translateX(-50%);
  color:#fff;
  background:rgba(0,0,0,.5);
  padding:4px 12px;
  border-radius:30px;
}
.viewer-close{
  position:fixed;
  top:36px;
  right:20px;
  width:36px;
  height:36px;
  background:rgba(255,255,255,.2);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  cursor:pointer;
  z-index: 10;
}