/* ==========================================================================
   1. BACKGROUND LAYER (bodyに全て集約して安定化)
   ========================================================================== */

body {
    margin: 0;
    padding: 0;
    background-color: #000000;
    color: var(--text-main);
    font-family: var(--font-body);
    position: relative; 
    
    /* ↓ これが必須：画面の高さ（100%）を基準にする ↓ */
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    overflow-x: hidden;
}

/* --- レイヤー1：左側ボルドー (ページ全体) --- */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 80%; 
    height: 100%;
    background: linear-gradient(to right, #5a0000 0%, #300000 40%, #000000 55%, transparent 90%);
    z-index: -3;
    opacity: 0.95;
}

/* --- レイヤー2：右側うねるネイビー (ページ全体) --- */
body::after {
    content: "";
    position: absolute;
    top: -10%;
    right: -15%;
    width: 65%;
    height: 120%;
    background: radial-gradient(ellipse at center, #001a4d 0%, #00081a 30%, #000000 50%, transparent 75%);
    mix-blend-mode: screen;
    filter: blur(30px);
    z-index: -2;
    pointer-events: none;
    animation: goldenWave 13s ease-in-out infinite;
}

@keyframes goldenWave {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(-14%, 2%) scale(1.05) rotate(1.5deg); }
}

/* ==========================================================================
   レイヤー3：火花エフェクト (body直下の擬似要素として追加)
   ========================================================================== */

/* bodyにさらに擬似要素を重ねることはできないため、
   ここを main::before ではなく html::before に引っ越します。
   これで main の干渉を完全に無視して画面に固定できます。
*/
html::before {
    content: "";
    position: fixed; /* これで確実に画面に張り付く */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; 
    pointer-events: none; 

    background-image: 
        radial-gradient(rgba(200, 50, 50, 0.4) 0%, rgba(200, 50, 50, 0) 70%),
        radial-gradient(rgba(255, 100, 100, 0.5) 0%, rgba(255, 100, 100, 0) 60%),
        radial-gradient(rgba(200, 50, 50, 0.3) 0%, rgba(200, 50, 50, 0) 70%),
        radial-gradient(rgba(200, 50, 50, 0.2) 0%, rgba(200, 50, 50, 0) 80%);

    background-size: 60px 60px, 50px 50px, 40px 40px, 80px 80px;
    background-repeat: no-repeat;
    
    animation: spParticleFly 15s ease-in-out infinite;
}

@keyframes spParticleFly {
    0%, 100% { 
        opacity: 0.8;
        background-position: 40% 110%, 60% 120%, 90% 100%, 110% 80%;
    }
    50% { 
        opacity: 0.2; 
        background-position: 10% 30%, 30% 50%, 60% 60%, 90% 40%;
    }
}

/* --- main自体の背景設定 --- */
main {
    position: relative;
    z-index: 1;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.4) 20%,
        rgba(0, 0, 0, 0.1) 50%,
        transparent 100%
    );
    backdrop-filter: blur(1px);

    /* ↓ ここを min-height から flex に書き換え ↓ */
    flex: 1; 
}


/* ==========================================================================
   2. HEADER & NAVIGATION (Ultra-Compact Edition)
   ========================================================================== */
.site-header {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.98) 0%, rgba(10, 5, 20, 0.9) 50%, var(--bg-purple-deep) 100%);
    border-bottom: 1.5px solid #f0e0ff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 2px 25px rgba(189, 0, 255, 0.6); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: fixed; 
    top: 0; left: 0; width: 100%;
    z-index: 99999; 
    height: 77px;
}

.site-header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent 0%, #f5eaff 20%, #f5eaff 80%, transparent 100%);
}

.header-inner {
    display: flex !important;
    position: relative; 
    justify-content: center;
    align-items: center;
    padding: 0 10px; /* 左右余白を最小化 */
    height: 100%;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    box-sizing: border-box;
}

.logo-area, .logo-link { display: flex; align-items: center; height: 100%; text-decoration: none; }
.site-logo-img { height: 65px; /* ロゴを少し小ぶりに */ filter: drop-shadow(1.5px 1.5px 0.3px rgba(255, 255, 255, 0.8)); }

.wiki-ver-tag {
    font-family: var(--font-heading);
    font-size: 9px; /* 固定サイズで最小化 */
    color: #ffffff; 
    text-shadow: 0 0 5px rgba(209, 102, 255, 0.8), 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-left: 6px; 
    padding-left: 6px; 
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 700; 
    letter-spacing: 0px;
    align-self: flex-end;      
    margin-bottom: 15px; 
    white-space: nowrap;
    opacity: 0.8;
}

.menu-list { display: flex; list-style: none; margin: 0; padding: 0; height: 100%; }

.menu-item { 
    position: relative; 
    height: 77px; 
    display: flex;
    align-items: center;
}

.menu-item > a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* パディングをさらに圧縮 (最小5px〜最大12px) */
    padding: 0 clamp(5px, 1vw, 12px);
    height: 100%; 
    color: #ffffff; 
    text-decoration: none;
    transition: background 0.3s ease;
}

/* 子要素ありの幅を大幅カット */
.menu-item.has-child > a { padding-right: 22px !important; }

.menu-item > a span {
    font-family: var(--font-heading);
    /* フォントサイズを一段階下げ、文字間をバキバキに詰める */
    font-size: clamp(0.95rem, 1.2vw, 1.15rem); 
    font-weight: 800; 
    line-height: 1; 
    letter-spacing: -0.2px; /* 文字間をマイナスに */
    text-transform: uppercase;
    white-space: nowrap;
}

.menu-item > a small { 
    font-size: 8px; /* 最小サイズ固定 */
    color: #b0b0bc; 
    margin-top: 1px; 
    white-space: nowrap;
    transform: scale(0.9); /* さらに視覚的に小さく */
    transform-origin: left top;
}

.menu-item.has-child > a::after {
    content: '';
    position: absolute;
    right: 8px; /* 右端に寄せる */
    top: 50%;
    width: 4px; height: 4px; /* 矢印を小さく */
    border-right: 1.5px solid #ffffff; border-bottom: 1.5px solid #ffffff;
    transform: translateY(-50%) rotate(45deg);
}

.menu-item:hover > a { background: rgba(255, 255, 255, 0.1); }


/* ==========================================================================
   3. DROPDOWN (挙動修正・超コンパクト版)
   ========================================================================== */
/* 親要素の relative 設定を確実に維持 */
.menu-item { 
    position: relative !important; 
    display: flex;
    align-items: center;
}

.dropdown {
    position: absolute;
    top: 100%; 
    left: 0;
    min-width: clamp(180px, 18vw, 280px); 
    list-style: none;
    padding: clamp(5px, 1vw, 10px) 0;
    margin: 0;
    
    background: linear-gradient(
        to right, 
        rgba(20, 0, 40, 0) 0%, 
        rgba(30, 0, 60, 0.85) 15%, 
        rgba(15, 0, 30, 0.95) 50%, 
        rgba(30, 0, 60, 0.85) 85%, 
        rgba(20, 0, 40, 0) 100%
    ) !important;
    
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    /* --- ここを復活：ヘッダーと同じ発光下線 --- */
    border-bottom: 1.5px solid #f0e0ff;
    box-shadow: 0 5px 15px rgba(189, 0, 255, 0.4); 
    /* -------------------------------------- */
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px); 
    transition: all 0.25s ease;
    z-index: 100000;
    pointer-events: none;
}

/* ホバー時に表示 */
.menu-item:hover > .dropdown { 
    opacity: 1; 
    visibility: visible; 
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown li {
    width: 100%;
}

.dropdown li a {
    display: block; 
    /* 余白をさらに削ってタイトに */
    padding: 8px 15px 8px clamp(30px, 3.5vw, 45px); 
    color: #ffffff; 
    text-decoration: none;
    /* フォントをもう一段階小さく設定 */
    font-size: clamp(0.8rem, 1vw, 1rem); 
    font-family: var(--font-heading); 
    font-weight: 600;
    position: relative; 
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* 棒線（—）をさらに短く、左へ */
.dropdown li a::before {
    content: '—'; 
    position: absolute; 
    left: clamp(12px, 2vw, 25px); 
    top: 50%; 
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7em;
}

.dropdown li a:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: clamp(35px, 4vw, 50px); 
    color: #f0c5ff;
}

/* ==========================================================================
   4. MAIN CONTENT & HERO
   ========================================================================== */
main {
    padding-top: 77px; 
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden; /* 横揺れ防止 */
}



/* 1000px以下の時はヘッダーが伸びるので余白を増やす */
@media screen and (max-width: 1000px) {
    main { padding-top: 130px; } 
}

.hero-section {
    width: 100%;
    max-width: 1300px;
    padding: 0 20px;
    margin-top: 15px; 
    box-sizing: border-box;
}

.hero-inner {
    width: 100%;
    filter: drop-shadow(0 0 20px rgba(209, 102, 255, 0.2));
}

.main-visual {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   5. RESPONSIVE & LAYOUT CORE (Stabilized & Safari Fix)
   ========================================================================== */

/* --- 1. ページ全体の自然な伸びを許可 --- */
html {
    height: auto !important; 
    margin: 0;
    padding: 0;
}

body {
    background: #000;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto !important; 
    overflow-y: visible !important; 
    overflow-x: hidden;
    position: relative;
}

body::before, body::after {
    content: "";
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: -1;
}

main {
    width: 100%;
    flex: 1 0 auto; 
    display: block; 
    position: relative;
    z-index: 1;
    padding-top: 77px;
    height: auto !important;
}

/* --- 2. ハンバーガーボタン --- */
.nav-toggle {
    display: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 22px;
    cursor: pointer;
    z-index: 100001;
}

.nav-toggle span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ffffff !important;
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 10px; }
.nav-toggle span:nth-child(3) { top: 20px; }

/* --- 3. 1000px以下：タブレット --- */
@media screen and (max-width: 1000px) and (min-width: 769px) {
    .site-header { height: auto; }
    .header-inner { flex-direction: column; padding: 10px 0 0 0; }
    .logo-area { height: 50px; justify-content: center; margin-bottom: 5px; width: 100%; }
    .menu-list { display: flex; width: 100%; justify-content: center; background: rgba(0, 0, 0, 0.3); }
    .menu-item { height: 55px; position: relative !important; }
    .menu-item > a { padding: 0 15px !important; }
    .menu-item > a span { font-size: 1.1rem !important; letter-spacing: 0.5px !important; }
    .menu-item > a small { transform: scale(1) !important; }
    main { padding-top: 125px; }
}

/* PC版：sp-onlyを完全に消す */
.sp-only {
    display: none !important;
}

/* --- 4. 768px以下：スマホ (ハンバーガーメニュー内) --- */
@media screen and (max-width: 768px) {
    /* 【背景】水色を完全に消して赤黒グラデーションを最優先 */
    html, body {
        background-color: #000000 !important;
    }
    body::after {
        display: none !important; /* 水色の原因を物理的に消去 */
    }
    body::before {
        content: "" !important;
        position: fixed !important;
        top: 0; left: 0;
        width: 100% !important;
        height: 100% !important;
        background: linear-gradient(135deg, #3d0000 0%, #000000 80%) !important;
        z-index: -1;
        opacity: 1 !important;
    }

    /* 【改行】スマホ時のみbrタグを有効化 */
    .sp-only {
        display: inline !important;
    }

    .site-header { height: 70px; }
    main { padding-top: 70px; }

    .header-inner {
        position: relative;
        justify-content: center;
        height: 100%;
    }

    .logo-area {
        position: absolute;
        /* 中央配置(50%)から 8px 左にずらして三本線との衝突回避 */
        left: calc(50% - 8px) !important; 
        top: 50%;
        transform: translate(-50%, -50%);
        height: 40px !important;
        z-index: 10;
        display: flex;
        flex-direction: column;
        align-items: center;
        white-space: nowrap;
    }

    .nav-toggle { display: block !important; }

    .menu-list {
        display: block;
        position: fixed;
        top: 0; right: -100%;
        width: 100%; max-width: 340px;
        height: 100vh;
        background: #0a0514;
        padding: 70px 0 40px;
        transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        z-index: 100000;
        overflow-y: auto;
    }

    .menu-list.active { right: 0; }

    .menu-item {
        display: grid !important;
        grid-template-columns: 120px 1fr !important;
        place-items: center stretch;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        min-height: 80px;
        height: auto !important;
        align-items: stretch !important;
    }

    .menu-item:not(.has-child) {
        display: block !important;
    }

    .menu-item > a {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        height: auto !important;
        min-height: 80px !important;
        flex-shrink: 0;
        margin: 0 !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        background: rgba(255, 255, 255, 0.03);
    }

    .menu-item.has-child > a {
        width: 120px !important;
        border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
    }

    .menu-item:not(.has-child) > a {
        width: 100% !important;
        border-right: none !important;
    }

    /* 【改行対応】displayをinline-blockに変更 */
    .menu-item > a span {
        display: inline-block !important; /* blockから変更してbrを有効化 */
        width: 100% !important;
        font-family: var(--font-heading);
        font-size: 0.75rem !important; 
        letter-spacing: 0.2px !important;
        line-height: 1.2 !important; /* 改行時の重なり防止 */
        white-space: normal !important; 
        word-break: break-all !important; 
    }
    
    .menu-item > a small {
        display: block !important;
        width: 100% !important;
        font-size: 8px !important;
        transform: scale(1) !important;
        margin-top: 4px;
        line-height: 1.2;
    }

    .dropdown {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
        padding: 0 !important;
    }

    .dropdown li { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
    .dropdown li a { 
        padding: 12px 15px !important; 
        font-size: 0.9rem !important; 
        white-space: normal !important;
        background: transparent !important;
    }

    .menu-item > a::after, 
    .dropdown li a::before, 
    .menu-item::after, 
    .menu-item::before, 
    .dropdown::after, 
    .dropdown::before { 
        display: none !important; 
        content: none !important; 
        box-shadow: none !important;
    }

    .nav-toggle.active span:nth-child(1) { transform: translateY(10px) rotate(45deg); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }
}

/* ==========================================================================
   6. FOOTER (タイト・ミニマルスタイル)
   ========================================================================== */
.site-footer {
    flex-shrink: 0; /* footerが押し潰されるのを防ぐ */
    background: #000;
    color: #fff;
    padding: 15px 20px; 
    border-top: 1px solid rgba(255, 255, 255, 0.15); 
    width: 100%;
    box-sizing: border-box;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-inner .copyright {
    font-size: 0.7rem; 
    opacity: 0.8;
    font-family: "Noto Sans JP", sans-serif;
}

.footer-inner .disclaimer {
    font-size: 0.6rem; 
    opacity: 0.4;
    font-family: "Noto Sans JP", sans-serif;
}

/* ==========================================================================
   7. BREADCRUMB (フッター連結・ワイドスタイル)
   ========================================================================== */

.breadcrumb-container {
    width: 100%;
    /* 画面いっぱいに広げる */
    margin: 60px 0 0 0; 
    padding: 15px 0;
    
    /* フッターとの一体感を出すための背景とボーダー */
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    
    box-sizing: border-box;
}

.breadcrumb-container ol {
    display: flex;
    justify-content: center; /* フッターと同じく中央寄せ */
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap; /* 折り返し許可 */
}

.breadcrumb-container li {
    display: flex;
    align-items: center;
    /* フッターに近い、小さく細いフォント */
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.65rem;
    color: #666;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* 区切り：スラッシュではなく、シンプルな棒でミニマルに */
.breadcrumb-container li:not(:last-child)::after {
    content: "|";
    margin: 0 15px;
    color: #333;
    font-weight: 100;
}

.breadcrumb-container a {
    color: #888; /* リンク色もあえて抑える */
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-container a:hover {
    color: #00f2ff; /* ホバーした時だけネオンブルーに */
}

/* モバイル対応：フッターと隙間なく連結 */
@media (max-width: 768px) {
    .breadcrumb-container {
        /* 上の余白を詰め、左右と下は0にしてフッターに密着させる */
        margin: 40px 0 0 0; 
        padding: 12px 10px;
        background: rgba(255, 255, 255, 0.03); /* 少しだけ明るくして視認性確保 */
    }
    
    .breadcrumb-container li {
        font-size: 0.6rem; /* さらに小さく */
    }

    .breadcrumb-container li:not(:last-child)::after {
        margin: 0 10px; /* 区切り幅もタイトに */
    }
}

/* ==========================================================================
   8. PAGE TOP BUTTON (レッドワイン・タクティカル)
   ========================================================================== */
#page-top {
    position: fixed !important;
    right: 30px;
    bottom: 30px;
    width: 46px;
    height: 46px;
    
    /* 背景：レッドワイン色（不透明にして背景に負けないようにする） */
    background-color: #5a0000 !important;
    
    /* 枠線：ホバー前は暗めの設定 */
    border: 1px solid rgba(255, 255, 255, 0.2); 
    
    /* 矢印の色（::beforeに継承） */
    color: rgba(255, 255, 255, 0.3); 
    
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100002 !important;
    
    /* 表示制御：activeクラスが付与された時のみ表示 */
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(4px);
}

#page-top.active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- ホバー時：白く発光して「入力感」を出す --- */
#page-top:hover {
    background-color: #800000 !important; /* 少し明るい赤へ */
    color: #ffffff !important;           /* 矢印を白へ */
    border-color: #ffffff !important;    /* 縁を白へ */
    
    /* 発光エフェクト */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5), 0 0 30px rgba(128, 0, 0, 0.6);
    transform: translateY(-5px); 
    cursor: pointer;
}

/* 矢印のデザイン（::before） */
#page-top::before {
    content: "";
    width: 9px;
    height: 9px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(-45deg);
    margin-top: 5px;
    transition: all 0.3s ease; /* 色の変化を滑らかに */
}