/* =========================================================
   画面右：Game8風スライドドロワー
========================================================= */

body.mm-toc-drawer-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* 背景オーバーレイ */
.mm-toc-drawer__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1998;
  background: rgba(15, 23, 42, .58);
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition:
    opacity .24s ease,
    visibility .24s ease;
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
}

.mm-toc-drawer__backdrop[hidden] {
  display: none !important;
}

.mm-toc-drawer__backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* 右ドロワー本体 */
.mm-toc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1999;
  display: flex;
  width: min(420px, 88vw);
  height: 100dvh;
  max-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid #dbe3ea;
  background: #fff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, .22);
  visibility: hidden;
  transform: translateX(100%);
  transition:
    transform .26s cubic-bezier(.22, 1, .36, 1),
    visibility .26s ease;
}

.mm-toc-drawer[hidden] {
  display: none !important;
}

.mm-toc-drawer.is-open {
  visibility: visible;
  transform: translateX(0);
}

/* 上部ヘッダー */
.mm-toc-drawer__header {
  display: flex;
  min-height: 68px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding:
    max(12px, env(safe-area-inset-top))
    16px
    12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.mm-toc-drawer__header-text {
  min-width: 0;
}

.mm-toc-drawer__eyebrow {
  display: block;
  margin: 0 0 2px;
  color: var(--teal-700);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.mm-toc-drawer__title {
  margin: 0;
  color: #172033;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

.mm-toc-drawer__close {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition:
    border-color .16s ease,
    background-color .16s ease,
    color .16s ease;
}

.mm-toc-drawer__close i {
  font-size: 19px;
  line-height: 1;
}

.mm-toc-drawer__close:hover,
.mm-toc-drawer__close:focus-visible {
  border-color: #7dd3c7;
  background: #ecfdfb;
  color: #0f766e;
}

.mm-toc-drawer__close:focus-visible {
  outline: 3px solid rgba(20, 184, 166, .20);
  outline-offset: 2px;
}

/* ドロワー内スクロール領域 */
.mm-toc-drawer__body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f4f6f8;
  scrollbar-gutter: stable;
}

/* 現在のページ */
.mm-toc-drawer__page {
  padding: 15px 16px;
  border-bottom: 1px solid #dfe5eb;
  background:
    linear-gradient(
      135deg,
      #effcf9 0%,
      #ffffff 74%
    );
}

.mm-toc-drawer__page-label {
  margin: 0 0 5px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
}

.mm-toc-drawer__page-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #0f766e;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* 各セクション */
.mm-toc-drawer__section {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #dfe5eb;
  background: #fff;
}

.mm-toc-drawer__section-title {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e6ebf0;
  background: #eef1f5;
  color: #273244;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.4;
}

.mm-toc-drawer__section-title i {
  width: 18px;
  color: #64748b;
  text-align: center;
}

/* ページ内目次 */
.mm-toc-drawer__toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
}

.mm-toc-drawer__toc-list > li {
  min-width: 0;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #e7ebef;
}

.mm-toc-drawer__toc-list > li:last-child {
  border-bottom: 0;
}

.mm-toc-drawer__toc-link {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  gap: 9px;
  padding: 11px 44px 11px 34px;
  background: #fff;
  color: #1f5f8f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  transition:
    background-color .15s ease,
    color .15s ease;
}

/* 番号だけを非表示。目次文字のspanは残す */
.mm-toc-drawer__toc-link > .mm-toc__num,
.mm-toc-drawer__toc-link > .mm-toc__number,
.mm-toc-drawer__toc-link > .mm-toc__index,
.mm-toc-drawer__toc-link > .mm-toc-number {
  display: none !important;
}

/* アイコンと文字の間隔を統一 */
.mm-toc-drawer__toc-link > i,
.mm-toc-drawer__toc-link > svg {
  width: 16px;
  flex: 0 0 16px;
  margin: 0;
  text-align: center;
}

.mm-toc-drawer__toc-link > strong,
.mm-toc-drawer__toc-link > span {
  min-width: 0;
}

.mm-toc-drawer__toc-link::before {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a8b4c2;
  content: "";
  transform: translateY(-50%);
}

.mm-toc-drawer__toc-link::after {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #7c8b9a;
  border-right: 2px solid #7c8b9a;
  content: "";
  transform:
    translateY(-50%)
    rotate(45deg);
}

.mm-toc-drawer__toc-link:hover,
.mm-toc-drawer__toc-link:focus-visible,
.mm-toc-drawer__toc-link.is-current,
.mm-toc-drawer__toc-link[aria-current="location"] {
  background: #eefcf9;
  color: #0f766e;
}

.mm-toc-drawer__toc-link:hover::before,
.mm-toc-drawer__toc-link:focus-visible::before,
.mm-toc-drawer__toc-link.is-current::before,
.mm-toc-drawer__toc-link[aria-current="location"]::before {
  background: var(--teal);
}

.mm-toc-drawer__toc-link:hover::after,
.mm-toc-drawer__toc-link:focus-visible::after,
.mm-toc-drawer__toc-link.is-current::after,
.mm-toc-drawer__toc-link[aria-current="location"]::after {
  border-color: var(--teal-700);
}

.mm-toc-drawer__toc-link:focus-visible {
  z-index: 1;
  outline: 3px solid rgba(20, 184, 166, .18);
  outline-offset: -3px;
}

/* サイトメニュー */
.mm-toc-drawer__site-links {
  display: grid;
  background: #fff;
}

.mm-toc-drawer__site-link {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 12px;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  border-bottom: 1px solid #e7ebef;
  color: #273244;
  text-decoration: none;
  transition:
    background-color .15s ease,
    color .15s ease;
}

.mm-toc-drawer__site-link:last-child {
  border-bottom: 0;
}

.mm-toc-drawer__site-link:hover,
.mm-toc-drawer__site-link:focus-visible,
.mm-toc-drawer__site-link.is-current {
  background: #f0fdfa;
  color: #0f766e;
}

.mm-toc-drawer__site-link:focus-visible {
  z-index: 1;
  outline: 3px solid rgba(20, 184, 166, .18);
  outline-offset: -3px;
}

.mm-toc-drawer__site-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #edf2f7;
  color: #536273;
}

.mm-toc-drawer__site-link:hover
  .mm-toc-drawer__site-icon,
.mm-toc-drawer__site-link:focus-visible
  .mm-toc-drawer__site-icon,
.mm-toc-drawer__site-link.is-current
  .mm-toc-drawer__site-icon {
  background: #d8f7f1;
  color: #0f766e;
}

.mm-toc-drawer__site-body {
  min-width: 0;
}

.mm-toc-drawer__site-body strong,
.mm-toc-drawer__site-body small {
  display: block;
}

.mm-toc-drawer__site-body strong {
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.45;
}

.mm-toc-drawer__site-body small {
  margin-top: 2px;
  color: #748091;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.45;
}

.mm-toc-drawer__site-arrow {
  color: #9aa6b3;
  font-size: 10px;
}

/* スクロールバー */
.mm-toc-drawer__body::-webkit-scrollbar {
  width: 8px;
}

.mm-toc-drawer__body::-webkit-scrollbar-track {
  background: #eef1f4;
}

.mm-toc-drawer__body::-webkit-scrollbar-thumb {
  border: 2px solid #eef1f4;
  border-radius: 999px;
  background: #a8b4c2;
}

.mm-toc-drawer__body {
  scrollbar-width: thin;
  scrollbar-color: #a8b4c2 #eef1f4;
}

/* 右下操作ボタン */
.mm-float {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 1900;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.mm-float__btns {
  display: flex;
  gap: 10px;
}

.mm-fbtn {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  box-shadow:
    0 10px 24px rgba(15, 23, 42, .18),
    0 3px 8px rgba(15, 23, 42, .12);
  cursor: pointer;
  transition:
    background-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}

.mm-fbtn i {
  font-size: 17px;
  line-height: 1;
}

.mm-fbtn:hover {
  background: #0d9488;
  transform: translateY(-2px);
}

.mm-fbtn:focus-visible {
  outline: 3px solid rgba(20, 184, 166, .28);
  outline-offset: 3px;
}

#tocBtn[aria-expanded="true"] {
  background: #0f766e;
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, .20),
    0 12px 28px rgba(15, 23, 42, .20);
}

.mm-fbtn--dark {
  background: #334155;
}

.mm-fbtn--dark:hover {
  background: #1f2937;
}

/* スマホ */
@media (max-width: 767px) {
  .mm-toc-drawer {
    width: min(360px, 86vw);
  }

  .mm-toc-drawer__header {
    min-height: 62px;
    padding:
      max(10px, env(safe-area-inset-top))
      12px
      10px;
  }

  .mm-toc-drawer__title {
    font-size: 16px;
  }

  .mm-toc-drawer__close {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .mm-toc-drawer__page {
    padding: 13px 14px;
  }

  .mm-toc-drawer__page-title {
    font-size: 12px;
  }

  .mm-toc-drawer__section-title {
    min-height: 46px;
    padding: 11px 14px;
    font-size: 12px;
  }

  .mm-toc-drawer__toc-link {
    min-height: 49px;
    padding:
      10px
      40px
      10px
      31px;
    font-size: 11px;
  }

  .mm-toc-drawer__toc-link::before {
    left: 15px;
  }

  .mm-toc-drawer__toc-link::after {
    right: 16px;
  }

  .mm-toc-drawer__site-link {
    grid-template-columns: 34px minmax(0, 1fr) 10px;
    min-height: 61px;
    gap: 10px;
    padding: 9px 14px;
  }

  .mm-toc-drawer__site-icon {
    width: 34px;
    height: 34px;
  }

  .mm-float {
    right: 12px;
    bottom:
      max(
        76px,
        calc(env(safe-area-inset-bottom) + 76px)
      );
  }
}

@media (max-width: 360px) {
  .mm-toc-drawer {
    width: 90vw;
  }

  .mm-toc-drawer__site-body small {
    display: none;
  }

  .mm-float {
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-toc-drawer,
  .mm-toc-drawer__backdrop,
  .mm-fbtn,
  .mm-toc-drawer__toc-link,
  .mm-toc-drawer__site-link {
    transition: none;
  }
}


/* =========================================================
   旧式目次を解析ページと同じ幅・位置で上書き
========================================================= */

#tocPopup.mm-toc-drawer {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 1999 !important;
  display: flex !important;
  width: min(420px, 88vw) !important;
  max-width: none !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-left: 1px solid #dbe3ea !important;
  border-radius: 0 !important;
  background: #fff !important;
  opacity: 1 !important;
  visibility: hidden !important;
  transform: translateX(100%) !important;
}

#tocPopup.mm-toc-drawer.is-open {
  visibility: visible !important;
  transform: translateX(0) !important;
}

#tocPopup.mm-toc-drawer[hidden] {
  display: none !important;
}

#tocDrawerContentsSection[hidden] {
  display: none !important;
}

#tocBackdrop.mm-toc-drawer__backdrop {
  display: block;
}

#tocBackdrop.mm-toc-drawer__backdrop[hidden] {
  display: none !important;
}

@media (max-width: 767px) {
  #tocPopup.mm-toc-drawer {
    width: min(360px, 86vw) !important;
  }
}

@media (max-width: 360px) {
  #tocPopup.mm-toc-drawer {
    width: 90vw !important;
  }
}