/* ============================================================
 右側に目次表示するやつ（PC画面用)
 ============================================================*/
#toc-target a.active-section {
    color: #ff0000 !important;
    font-weight: bold !important;
    border-left: 3px solid #ff0000;
    padding-left: 5px;
    background-color: #fff5f5;
}

/* PC表示時（768px以上）のレイアウト最適化 */
@media (min-width: 1000px) {
  
      /* 5. 画面右側に浮く目次の設定 */
  #floating-toc {
        position: fixed !important;
        top: 120px;
        right: 5px; /* 右端からの距離 */
        width: calc(50vw - 475px - 20px); /* 画面中央からコンテナ半分を引いた余白分 */
        min-width: 80px; /* 狭くなりすぎないよう最小幅を設定 */
        max-width: 300px; /* 広くなりすぎないよう最大幅を設定 */
        max-height: 80vh;
        overflow-y: auto;
        background: #fff;
        border: 1px solid #ddd;
        padding: 15px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        border-radius: 4px;
        box-sizing: border-box;
    }
  
    /* 目次のタイトルと最小化ボタン */
    .toc-title {
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 10px;
        border-bottom: 2px solid #eee;
        color: #333;
        padding-bottom: 5px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    #toc-toggle {
        font-size: 11px;
        color: #888;
        cursor: pointer;
        font-weight: normal;
    }
    #toc-toggle:hover { color: #333; }

    /* 目次内の各項目の区切り線 */
    #toc-target div {
        border-bottom: 3px solid #eee;
        padding: 4px 0;
    }
    #toc-target div:last-child { border-bottom: none; }

    /* 目次内のリンク文字（文字溢れ対策込み） */
    #toc-target a {
        font-size: 13px;
        color: #0077bb;
        text-decoration: none;
        display: block;
        line-height: 1.4;
        /* --- 文字溢れ対策 --- */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* 2. マウスをのせた時（ホバー時）の設定 */
    #toc-target a:hover {
      color: #005588 !important;   /* 少し濃い青色に */
      font-weight: bold !important; /* 太字にする */
      background-color: #f0f8ff;    /* ほんのり薄い水色背景 */
      text-decoration: none;        /* 下線は不要（太字で十分目立つため） */
    }
    /* 現在地ハイライトの色設定 */
    #toc-target a.active-section {
        color: #ff6600 !important; /* 目立つオレンジ */
        font-weight: bold !important;
        border-left: 2px solid #ff6600;
        padding-left: 4px;
    }
    #toc-target a:hover { background-color: #f9f9f9; }

    /* --- 字下げ設定 --- */
    .toc-page-name { padding-left: 0px !important; font-weight: bold; }
    .toc-h1 { padding-left: 8px !important; }
    .toc-h2 { padding-left: 18px !important; font-size: 0.95em !important; }
    .toc-h3 { padding-left: 28px !important; font-size: 0.9em !important; color: #666; }
  　
}




/* --- スマホ画面（1000px以下）のUI変更 --- */
@media (max-width: 1000px) {
    #floating-toc {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: -100% !important; 
        width: 70vw !important; 
        height: 100vh !important;
        max-height: 100vh !important;
        background: #fff !important;
        z-index: 100000 !important;
        transition: right 0.3s ease-in-out !important;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2) !important;
        padding: 0 !important; 
        overflow-y: auto !important;
        border: none !important;
        border-radius: 0 !important;
    }

    #floating-toc.is-open {
        right: 0 !important;
    }

    /* 目次内のヘッダー */
    .toc-title {
        background: #f8f8f8;
        padding: 20px;
        font-size: 18px !important; 
        border-bottom: 1px solid #eee;
        margin-bottom: 0 !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: sticky !important; /* スクロールしても上部に張り付く */
        top: 0;                      /* 張り付く位置 */
        z-index: 10;                 /* 項目より上に表示 */
    }

    /* ×ボタン */
    #toc-toggle {
        font-size: 24px !important;
        color: #333 !important;
        width: 40px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #eee;
        border-radius: 50%;
        cursor: pointer;
    }

    /* 項目全体のリスト：左右のパディングを0にしてaタグを端まで届かせる */
    #toc-target {
        padding: 10px 0 !important;
    }

    /* 項目ごとの枠：ここもパディングを0にする */
    #toc-target div {
        border-bottom: 1px solid #f0f0f0 !important;
        padding: 0 !important; 
        margin: 0 !important;
    }

    /* 【重要】当たり判定を横いっぱいに広げる設定 */
    #toc-target a {
        display: block !important;    /* 1行まるごとボタン化 */
        width: 100% !important;
        padding: 10px 20px !important; /* リンクの内側に余白を作る（タップしやすさUP） */
        font-size: 16px !important; 
        line-height: 1.4 !important;
        white-space: normal !important; 
        text-overflow: clip !important;
        overflow: visible !important;
        box-sizing: border-box !important; /* paddingを幅に含める */
        text-decoration: none !important;
        color: #0077bb;
    }

    /* タップした瞬間に背景色を変えてフィードバックを出す */
    #toc-target a:active {
        background-color: #f0f0f0 !important;
    }

    /* JSで付与されるクラスに基づいた字下げ調整 */
    #toc-target .toc-page-name a { padding-left: 20px !important; }
    #toc-target .toc-h1 a { padding-left: 20px !important; }
    #toc-target .toc-h2 a { padding-left: 35px !important; } /* 字下げをaのpaddingで制御 */
    #toc-target .toc-h3 a { padding-left: 50px !important; }

    /* 三本線ボタン */
    #sp-toc-open-btn {
        position: fixed !important;
        right: 0 !important;
        top: 50% !important;
        width: 50px !important;
        height: 60px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px 0 0 10px !important;
        z-index: 99999 !important;
        cursor: pointer !important;
        font-size: 30px !important;
    }

    #sp-toc-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.5) !important;
        display: none;
        z-index: 99999 !important;
    }
}





















/* ============================================================
   表示切り替えシステム（クリーン版・特定ページのみ表示対応）
   ============================================================ */

/* 1. ボタン：機能に特化 */
#content-toggler {
    display: none; /* 初期は非表示（JSで生成・制御） */
    position: fixed;
    right: 20px;
    bottom: 50px;
    z-index: 1001;
    background: #ff0000;
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 25px;
    border: none !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* JSによって生成された場合に表示を許可 */
body #content-toggler {
    display: block;
}

#content-toggler.is-active {
    background: #444;
}

/* 2. コンテンツ制御：Wikiの自動整形による余白を「相殺」する */
.toggle-wrapper {
    display: block !important;
    /* Wikiの空行を相殺するための補正 */
    margin-top: -1em !important;
    margin-bottom: -1.6em !important;
}

/* 内部のゴミ（自動改行）を掃除 */
.toggle-wrapper br, 
.toggle-wrapper p:empty {
    display: none !important;
}

/* 切り替え対象の共通設定 */
.content-a, .content-b {
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. 切り替えロジック：もっとも標準的な書き方 */
.content-b { display: none !important; }

/* 補足：フェードイン（JS）と喧嘩しないよう、body:hasによる消去は予備として保持 */
body:has(#content-toggler.is-active) .content-a { display: none !important; }
body:has(#content-toggler.is-active) .content-b { display: block !important; }