/* ============================================================
   toc.css —— 目录抽屉（对应设计图 2）
   ============================================================ */

.toc-mask {
  position: absolute;
  inset: 0;
  z-index: 66;
  background: var(--ui-mask);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.toc-mask.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease;
}

.toc-drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 67;
  width: 88vw;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  background: var(--ui-bg);
  color: var(--ui-text);
  transform: translateX(-101%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.toc-drawer.is-open {
  transform: translateX(0);
}

.toc-head {
  flex: none;
  padding: calc(env(safe-area-inset-top) + 16px) 16px 0;
}

.toc-book {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toc-cover {
  flex: none;
  width: 58px;
  height: 78px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--ui-chip);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

.toc-book-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-author {
  font-size: 13px;
  color: var(--ui-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-book-arrow {
  flex: none;
  margin-left: auto;
  color: var(--ui-sub);
  font-size: 18px;
  line-height: 1;
}

.toc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 10px;
  font-size: 13px;
  color: var(--ui-sub);
}

.toc-sort {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ui-sub);
}

.toc-sort svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
}

/* ---------- 章节列表 ---------- */

.toc-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 calc(env(safe-area-inset-bottom) + 24px);
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px 16px;
  font-size: 16px;
  color: var(--ui-text);
  line-height: 1.4;
}

.toc-item-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.toc-item-icon {
  flex: none;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}

.toc-item.is-current {
  color: var(--ui-accent);
}

.toc-item.is-current .toc-item-icon {
  visibility: visible;
}
