/* 떠다니는 목차 (데스크탑) */
.floating-toc {
    position: fixed;
    top: 80px;
    left: calc(50% - 640px / 2 - 280px);
    background: #f7f9fa;
    border: 1px solid #ccc;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    max-width: 250px;
    max-height: 50vh; /* 화면 높이의 80%까지만 */
    overflow-y: auto;  /* 세로 스크롤 허용 */
    z-index: 999;
    display: none;
  }
  
  .floating-toc .toc-title {
    display: block;
    font-weight: bold;
    margin-bottom: 1rem;
  }

  html.dark .floating-toc {
    background: #1f1f2b;
    border-color: #444;
    color: #ddd;
  }
  
  @media (max-width: 768px) {
    .floating-toc {
      display: none !important; /* 모바일에서는 아예 숨김 */
    }
  }

  /* 모바일 전용 목차 버튼 */
  .mobile-toc-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 0 16px;
    height: 48px;
    font-size: 16px;
    font-weight: bold;
    background-color: #0077cc;
    color: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999;
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
  }
  
  
  @media (max-width: 768px) {
    .mobile-toc-button {
      display: flex;
    }
  }
  
  /* 모바일 토글 목차 */
  .mobile-toc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  
  .mobile-toc-content {
    background: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    padding: 1rem;
  }
  
  html.dark .mobile-toc-content {
    background: #1f1f2b;
    color: white;
  }

  .mobile-toc-button {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
  }
  
  .mobile-toc-button.show {
    opacity: 1;
    pointer-events: auto;
  }

  html.modal-open,
body.modal-open {
    overflow: hidden;
    touch-action: none; /* 터치 스크롤도 차단 */
    height: 100%; /* 모바일 크롬 대응 */
  }

 