/* === Floating TOC + Progress Bar (Organic Chemistry theme) === */
#floating-toc {
  position: fixed;
  right: 12px;
  top: 60px;
  z-index: 200;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  max-width: 260px;
}

#toc-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0d6b3d;
  color: #fff;
  font-size: 18px;
  text-align: center;
  line-height: 36px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s;
  user-select: none;
}
#toc-toggle:hover {
  background: #27ae60;
  transform: scale(1.1);
}

#toc-list-wrap {
  margin-top: 44px;
  background: #fff;
  border: 1px solid #d5d5d5;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 0;
  overflow: hidden;
}

#toc-title {
  padding: 10px 14px 8px;
  font-size: 13px;
  font-weight: bold;
  color: #0d6b3d;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

#toc-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
}
#toc-list::-webkit-scrollbar { width: 4px; }
#toc-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

#toc-list li { margin: 0; padding: 0; }

#toc-list a {
  display: block;
  padding: 5px 14px;
  font-size: 12px;
  color: #555;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toc-list a.toc-h3 {
  padding-left: 26px;
  font-size: 11.5px;
  color: #888;
}
#toc-list a:hover {
  background: #e8f5e9;
  color: #0d6b3d;
  border-left-color: #27ae60;
}
#toc-list a.toc-active {
  background: #c8e6c9;
  color: #0d6b3d;
  font-weight: bold;
  border-left-color: #e74c3c;
}

/* Progress bar */
#toc-progress-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding-right: 44px;
}
#toc-progress-bar {
  height: 4px;
  background: linear-gradient(90deg, #0d6b3d, #27ae60);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s;
  flex: 1;
  min-width: 0;
}
#toc-progress-text {
  font-size: 11px;
  color: #888;
  min-width: 30px;
  text-align: right;
}

#reading-progress-top {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #0d6b3d, #e74c3c);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s;
}

@media (max-width: 1100px) {
  #floating-toc { right: 8px; top: 88px; max-width: 240px; }
  #toc-progress-wrap { display: none; }
}

@media (max-width: 768px) {
  #floating-toc { right: 6px; top: 83px; max-width: 220px; }
  #toc-list { max-height: 60vh; }
}

#floating-toc { will-change: transform; }
#reading-progress-top { will-change: width; }
