/* ============================================
   STGR WIKI — Hybrid Responsive Stylesheet
   PC: 案2 (Split Explorer)
   Mobile: 案1 (Vertical Tree Accordion)
   ============================================ */

/* --- 全体レイアウト --- */
.wiki-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 80px;
    position: relative;
    z-index: 1;
}

/* --- 上部コントロールエリア --- */
.wiki-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    background: rgba(13, 2, 33, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 12px;
    padding: 18px 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

@media (min-width: 768px) {
    .wiki-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* 収録件数ステータスバッジ（パターンB） */
.wiki-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(5, 1, 15, 0.75);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 24px;
    padding: 8px 18px;
    color: var(--neon-cyan, #00ffff);
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.8px;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.12);
    user-select: none;
    white-space: nowrap;
}

.wiki-stats-badge .material-icons {
    font-size: 16px;
    color: rgba(0, 255, 255, 0.85);
}

.wiki-stats-badge .wiki-stats-count {
    color: #fff;
    font-weight: 700;
}

/* 検索バー */
.wiki-search-box {
    position: relative;
    flex: 1;
    max-width: 500px;
    width: 100%;
}

.wiki-search-box .material-icons.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 255, 255, 0.6);
    pointer-events: none;
    font-size: 20px;
}

.wiki-search-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(5, 1, 15, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 24px;
    padding: 10px 42px 10px 42px;
    color: var(--text-white, #fff);
    font-family: var(--font-body, 'Rajdhani', sans-serif);
    font-size: 15px;
    transition: all 0.3s ease;
}

.wiki-search-input:focus {
    outline: none;
    border-color: var(--neon-cyan, #00ffff);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.35);
    background: rgba(10, 2, 25, 0.9);
}

.wiki-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(176, 250, 255, 0.6);
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    justify-content: center;
}

.wiki-search-clear:hover {
    color: #ff0055;
}

.wiki-search-count {
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    color: var(--neon-cyan, #00ffff);
    margin-top: 4px;
    padding-left: 12px;
    display: none;
}

/* シーズンタグコンテナ */
.wiki-season-tags {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}

/* バッジ共通スタイル */
.season-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
    transition: all 0.2s ease;
    user-select: none;
}

.season-badge--s1 {
    background: rgba(147, 112, 219, 0.2);
    color: #c4a1ff;
    border: 1px solid rgba(147, 112, 219, 0.6);
    box-shadow: 0 0 6px rgba(147, 112, 219, 0.25);
    text-shadow: 0 0 4px rgba(147, 112, 219, 0.6);
}

.season-badge--s2 {
    background: rgba(0, 255, 178, 0.15);
    color: #00ffb2;
    border: 1px solid rgba(0, 255, 178, 0.6);
    box-shadow: 0 0 6px rgba(0, 255, 178, 0.25);
    text-shadow: 0 0 4px rgba(0, 255, 178, 0.6);
}

.season-badge--s1:hover {
    background: rgba(147, 112, 219, 0.35);
    box-shadow: 0 0 10px rgba(147, 112, 219, 0.5);
}

.season-badge--s2:hover {
    background: rgba(0, 255, 178, 0.25);
    box-shadow: 0 0 10px rgba(0, 255, 178, 0.5);
}

/* ========================================================
   PCモード (min-width: 900px): 案2 (Split Explorer)
   ======================================================== */
@media (min-width: 900px) {
    .wiki-main-layout {
        display: grid;
        grid-template-columns: 320px 1fr;
        gap: 28px;
        align-items: flex-start;
    }

    /* 左カラム: 大項目サイドバー */
    .wiki-sidebar {
        background: rgba(13, 2, 33, 0.75);
        border: 1px solid rgba(0, 255, 255, 0.2);
        border-radius: 12px;
        padding: 16px 12px;
        backdrop-filter: blur(10px);
        position: sticky;
        top: 90px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .wiki-sidebar::-webkit-scrollbar {
        width: 4px;
    }
    .wiki-sidebar::-webkit-scrollbar-thumb {
        background: rgba(0, 255, 255, 0.3);
        border-radius: 4px;
    }

    .wiki-sidebar-header {
        font-family: var(--font-display, 'Orbitron', sans-serif);
        font-size: 13px;
        letter-spacing: 1.5px;
        color: var(--neon-cyan, #00ffff);
        padding: 8px 12px 14px;
        border-bottom: 1px solid rgba(0, 255, 255, 0.15);
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .wiki-major-nav-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .wiki-major-nav-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 11px 14px;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid transparent;
        border-radius: 8px;
        color: var(--text-white, #e0e0e0);
        cursor: pointer;
        transition: all 0.25s ease;
        text-align: left;
        font-family: var(--font-body, 'Rajdhani', sans-serif);
        font-size: 15px;
        font-weight: 600;
    }

    .wiki-major-nav-btn:hover {
        background: rgba(0, 255, 255, 0.08);
        border-color: rgba(0, 255, 255, 0.3);
        color: #fff;
        transform: translateX(3px);
    }

    .wiki-major-nav-btn.active {
        background: linear-gradient(90deg, rgba(0, 255, 255, 0.2), rgba(0, 255, 255, 0.05));
        border-left: 3px solid var(--neon-cyan, #00ffff);
        border-color: rgba(0, 255, 255, 0.5);
        color: var(--neon-cyan, #00ffff);
        box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
    }

    .wiki-major-nav-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .wiki-major-nav-left .material-icons {
        font-size: 19px;
        color: rgba(0, 255, 255, 0.8);
    }

    .wiki-major-nav-btn.active .wiki-major-nav-left .material-icons {
        color: var(--neon-cyan, #00ffff);
        text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    }

    .wiki-major-nav-count {
        background: rgba(0, 255, 255, 0.1);
        color: rgba(0, 255, 255, 0.8);
        font-family: var(--font-mono, monospace);
        font-size: 11px;
        padding: 2px 7px;
        border-radius: 12px;
        border: 1px solid rgba(0, 255, 255, 0.2);
    }

    /* 右カラム: 詳細アコーディオンパネル */
    .wiki-content-area {
        background: rgba(13, 2, 33, 0.75);
        border: 1px solid rgba(0, 255, 255, 0.2);
        border-radius: 12px;
        padding: 24px 28px;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        min-height: 500px;
    }

    .wiki-category-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(0, 255, 255, 0.15);
    }

    .wiki-category-title-wrap {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 6px;
    }

    .wiki-category-title {
        font-family: var(--font-display, 'Orbitron', sans-serif);
        font-size: 22px;
        font-weight: 700;
        color: var(--neon-cyan, #00ffff);
        margin: 0;
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    }

    .wiki-category-desc {
        color: var(--text-muted, rgba(176, 250, 255, 0.6));
        font-size: 14px;
        margin: 0;
    }

    /* モバイル専用コンテナはPCでは非表示 */
    .wiki-mobile-tree {
        display: none !important;
    }
}

/* ========================================================
   スマホ・タブレットモード (max-width: 899px): 案1 (Tree Accordion)
   ======================================================== */
@media (max-width: 899px) {
    /* PC用サイドバー＆右パネルレイアウトは非表示 */
    .wiki-main-layout {
        display: none !important;
    }

    /* モバイルツリーアコーディオンを表示 */
    .wiki-mobile-tree {
        display: flex !important;
        flex-direction: column;
        gap: 14px;
    }

    /* 大項目アコーディオンカード */
    .wiki-tree-major-card {
        background: rgba(13, 2, 33, 0.75);
        border: 1px solid rgba(0, 255, 255, 0.2);
        border-radius: 10px;
        overflow: hidden;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        transition: border-color 0.3s ease;
    }

    .wiki-tree-major-card.is-open {
        border-color: rgba(0, 255, 255, 0.5);
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.15);
    }

    .wiki-tree-major-header {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        background: transparent;
        border: none;
        color: var(--text-white, #fff);
        cursor: pointer;
        text-align: left;
    }

    .wiki-tree-major-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .wiki-tree-major-left .material-icons {
        color: var(--neon-cyan, #00ffff);
        font-size: 22px;
    }

    .wiki-tree-major-title {
        font-family: var(--font-display, 'Orbitron', sans-serif);
        font-size: 16px;
        font-weight: 600;
        color: var(--text-white, #fff);
    }

    .wiki-tree-major-card.is-open .wiki-tree-major-title {
        color: var(--neon-cyan, #00ffff);
    }

    .wiki-tree-chevron {
        color: rgba(0, 255, 255, 0.6);
        transition: transform 0.3s ease;
    }

    .wiki-tree-major-card.is-open > .wiki-tree-major-header .wiki-tree-chevron {
        transform: rotate(180deg);
        color: var(--neon-cyan, #00ffff);
    }

    /* モバイルツリー展開部（中項目コンテナ） */
    .wiki-tree-major-body {
        display: none;
        padding: 0 14px 14px 24px;
        position: relative;
        border-top: 1px solid rgba(0, 255, 255, 0.1);
    }

    .wiki-tree-major-card.is-open > .wiki-tree-major-body {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-top: 12px;
    }

    /* ツリーガイド線 */
    .wiki-tree-major-body::before {
        content: '';
        position: absolute;
        left: 24px;
        top: 12px;
        bottom: 16px;
        width: 2px;
        background: linear-gradient(180deg, rgba(0, 255, 255, 0.4), rgba(255, 0, 255, 0.2));
    }
}

/* ========================================================
   中項目・小項目アコーディオン (PC・モバイル共通コンポーネント)
   ======================================================== */
.wiki-medium-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wiki-medium-card {
    background: rgba(18, 5, 45, 0.6);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wiki-medium-card:hover {
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow: 0 2px 12px rgba(0, 255, 255, 0.1);
}

.wiki-medium-card.is-open {
    border-color: var(--neon-cyan, #00ffff);
    background: rgba(22, 6, 55, 0.85);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.18);
}

.wiki-medium-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: transparent;
    border: none;
    color: var(--text-white, #fff);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}

.wiki-medium-header:hover {
    background: rgba(0, 255, 255, 0.05);
}

.wiki-medium-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wiki-medium-name {
    font-family: var(--font-body, 'Rajdhani', sans-serif);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}

.wiki-medium-card.is-open .wiki-medium-name {
    color: var(--neon-cyan, #00ffff);
}

.wiki-medium-desc-inline {
    font-size: 13px;
    color: var(--text-muted, rgba(176, 250, 255, 0.55));
    font-weight: 400;
}

.wiki-medium-chevron {
    color: rgba(0, 255, 255, 0.6);
    transition: transform 0.3s ease;
    font-size: 20px;
}

.wiki-medium-card.is-open .wiki-medium-chevron {
    transform: rotate(180deg);
    color: var(--neon-cyan, #00ffff);
}

/* 小項目の展開エリア */
.wiki-subitems-container {
    display: none;
    padding: 14px 20px 18px;
    background: rgba(10, 2, 28, 0.9);
    border-top: 1px dashed rgba(0, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .wiki-container {
        padding: 14px 10px 60px;
    }
    .wiki-subitems-container {
        padding: 10px 6px 14px;
    }
    .wiki-tree-major-body {
        padding: 0 8px 12px 14px;
    }
    .wiki-subitem-body {
        padding: 10px 8px;
    }
}

.wiki-medium-card.is-open .wiki-subitems-container {
    display: block;
    animation: fadeInSlide 0.3s ease forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 小項目アコーディオンコンテナ (目次見出しバー) */
.wiki-subitem-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 一括開閉ボタンバー */
.wiki-subitems-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.wiki-subitems-action-btn {
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: var(--neon-cyan, #00ffff);
    font-size: 11px;
    font-family: var(--font-display, 'Orbitron', sans-serif);
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wiki-subitems-action-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

/* 小項目アコーディオン（見出しバー） */
.wiki-subitem-accordion {
    background: rgba(14, 4, 35, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.18);
    border-left: 3px solid rgba(0, 255, 255, 0.6);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.wiki-subitem-accordion:hover {
    border-color: rgba(0, 255, 255, 0.45);
    border-left-color: var(--neon-cyan, #00ffff);
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.12);
}

.wiki-subitem-accordion.is-open {
    border-color: rgba(0, 255, 255, 0.5);
    border-left-color: var(--neon-cyan, #00ffff);
    background: rgba(18, 5, 45, 0.85);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.wiki-subitem-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: var(--text-white, #fff);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}

.wiki-subitem-header:hover {
    background: rgba(0, 255, 255, 0.06);
}

.wiki-subitem-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-subitem-header-left .subitem-icon {
    font-size: 16px;
    color: var(--neon-cyan, #00ffff);
}

.wiki-subitem-title-text {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #e0f7ff;
}

.wiki-subitem-accordion.is-open .wiki-subitem-title-text {
    color: var(--neon-cyan, #00ffff);
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
}

.wiki-subitem-chevron {
    color: rgba(0, 255, 255, 0.6);
    font-size: 18px;
    transition: transform 0.25s ease;
}

.wiki-subitem-accordion.is-open > .wiki-subitem-header .wiki-subitem-chevron {
    transform: rotate(180deg);
    color: var(--neon-cyan, #00ffff);
}

/* アコーディオン本文展開部 */
.wiki-subitem-body {
    display: none;
    padding: 12px 14px;
    background: rgba(7, 1, 20, 0.85);
    border-top: 1px dashed rgba(0, 255, 255, 0.2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.4) rgba(5, 1, 15, 0.5);
}

/* 横スクロールバーのサイバースタイル */
.wiki-subitem-body::-webkit-scrollbar {
    height: 6px;
}
.wiki-subitem-body::-webkit-scrollbar-track {
    background: rgba(5, 1, 15, 0.6);
    border-radius: 3px;
}
.wiki-subitem-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.45);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}
.wiki-subitem-body::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan, #00ffff);
}

.wiki-subitem-accordion.is-open > .wiki-subitem-body {
    display: block;
    animation: fadeInSlide 0.25s ease forwards;
}

/* データテーブル（スマホで圧縮されず横スライド可能にする） */
.wiki-data-table {
    width: 100%;
    min-width: 540px; /* 狭い画面でも列が潰れない最小幅 */
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    table-layout: auto;
}

@media (max-width: 768px) {
    .wiki-data-table {
        min-width: 480px;
        font-size: 12px;
    }
}

.wiki-data-table th {
    background: rgba(0, 255, 255, 0.15);
    color: var(--neon-cyan, #00ffff);
    border: 1px solid rgba(0, 255, 255, 0.25);
    padding: 8px 12px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.wiki-data-table td {
    border: 1px solid rgba(0, 255, 255, 0.15);
    padding: 8px 12px;
    color: var(--text-white, #e0e0e0);
    background: rgba(5, 1, 15, 0.5);
    vertical-align: top;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .wiki-data-table th,
    .wiki-data-table td {
        padding: 6px 9px;
    }
}

.wiki-data-table tr:nth-child(even) td {
    background: rgba(18, 5, 45, 0.5);
}

.wiki-data-table tr:hover td {
    background: rgba(0, 255, 255, 0.08);
}

.wiki-subitem-html h3 {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 14px;
    color: var(--neon-cyan, #00ffff);
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    padding-bottom: 4px;
    margin: 16px 0 8px;
}

.wiki-subitem-html h4 {
    font-size: 13px;
    color: var(--neon-magenta, #ff00ff);
    margin: 12px 0 6px;
}

.wiki-subitem-html h4.wiki-subheading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 0, 255, 0.08);
    border-left: 3px solid var(--neon-magenta, #ff00ff);
    padding: 4px 10px;
    border-radius: 0 4px 4px 0;
    margin: 14px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #ff80ff;
    letter-spacing: 0.5px;
}

.wiki-subitem-html ul, .wiki-subitem-html ol {
    margin: 8px 0;
    padding-left: 22px;
    color: #e6e6e6;
}

.wiki-subitem-html li {
    margin-bottom: 4px;
    line-height: 1.5;
}

.wiki-subitem-html p {
    margin: 6px 0 10px;
    line-height: 1.6;
    color: #e0e0e0;
}

.wiki-subitem-html a {
    color: var(--neon-cyan, #00ffff);
    text-decoration: none;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.4);
    transition: color 0.2s ease;
}

.wiki-subitem-html a:hover {
    color: var(--neon-magenta, #ff00ff);
    border-bottom-color: var(--neon-magenta, #ff00ff);
}

/* 定義リスト（旧 dl / dt / dd の安全化スタイル） */
.wiki-dl {
    margin: 10px 0;
}
.wiki-dt {
    font-weight: 600;
    font-size: 13px;
    color: var(--neon-cyan, #00ffff);
    margin-top: 10px;
    margin-bottom: 4px;
}
.wiki-dd {
    margin-left: 10px;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.wiki-subitem-title {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 12px;
    font-weight: 600;
    color: var(--neon-cyan, #00ffff);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wiki-subitem-content {
    font-family: var(--font-body, 'Rajdhani', sans-serif);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-white, #e6e6e6);
    margin: 0;
}

/* 検索ヒット時・ハイライト */
.highlight-match {
    background: rgba(255, 0, 255, 0.3);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
    text-shadow: 0 0 6px rgba(255, 0, 255, 0.8);
}

/* 該当なしメッセージ */
.wiki-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, rgba(176, 250, 255, 0.5));
}
.wiki-empty-state .material-icons {
    font-size: 48px;
    color: rgba(0, 255, 255, 0.3);
    margin-bottom: 12px;
}
