/* Contents menu: button bottom-right, beside the slide arrows. Shared by every deck page. */
.toc-btn {
  position: fixed; z-index: 16;
  right: 74px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  font: 700 15px/1 var(--f-body);
  box-shadow: 0 10px 24px -14px rgba(14, 15, 18, 0.45);
}
.toc-btn:hover { border-color: var(--ink); }
.toc-btn svg { width: 18px; height: 18px; color: var(--blue); }
.toc-btn[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toc-btn[aria-expanded="true"] svg { color: #fff; }

.toc {
  position: fixed; z-index: 17;
  right: 18px; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: min(340px, calc(100vw - 32px)); max-height: min(640px, calc(100svh - 160px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 60px -24px rgba(14, 15, 18, 0.4);
  overflow: hidden;
}
.toc[hidden] { display: none; }
.toc-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; margin: 12px 12px 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.toc-switch a {
  text-align: center; padding: 10px 0; border-radius: 7px;
  font: 800 15px/1 var(--f-display); letter-spacing: 0.02em; color: var(--muted); text-decoration: none;
}
.toc-switch a:hover { color: var(--ink); }
.toc-switch a[aria-current="page"] { background: var(--blue); color: #fff; }
.toc-head { padding: 10px 18px 8px; font: 600 11px/1 var(--f-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.toc-list { list-style: none; margin: 0; padding: 0 8px 10px; overflow-y: auto; }
.toc-list button {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left;
  font: 500 15px/1.3 var(--f-body); color: var(--ink);
}
.toc-list button:hover { background: var(--blue-soft); }
.toc-list .n { flex: none; width: 24px; font: 600 12px/1 var(--f-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.toc-list button.on { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.toc-list button.on .n { color: var(--blue); }
