/* ===== リセット & 変数 ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:        #111111;
    --bg-sub:    #1a1a1a;
    --bg-card:   #222222;
    --border:    #333333;
    --text:      #e0e0e0;
    --text-sub:  #999999;
    --link:      #7eb8f7;
    --link-hover:#a8d0ff;
    --accent:    #ffffff;
    --header-h:  56px;
    --max-w:     960px;
    --font-sans: 'Noto Sans JP', sans-serif;
    --font-serif:'Noto Serif JP', serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* ===== ヘッダー ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: #0a0a0a;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
}

.header-octagon {
    width: 36px;
    height: 36px;
    background: #ffffff;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.header-logo:hover .header-octagon {
    transform: scale(1.1);
    opacity: 0.85;
}

.header-octagon-text {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    line-height: 1;
}

.header-section-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-sub);
    letter-spacing: 0.05em;
}

/* ===== メインラッパー ===== */
.site-wrapper {
    flex: 1;
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 24px 16px 48px;
}

/* ===== フッター ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 16px;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-x-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #000;
    color: #fff;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.footer-x-btn:hover {
    background: #1a1a1a;
    border-color: #666;
    color: #fff;
    text-decoration: none;
}

.footer-x-btn svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.footer-copy {
    font-size: 13px;
    color: var(--text-sub);
}

/* ===== 広告枠 ===== */
.banner-slot {
    width: 100%;
    margin: 16px 0;
    display: block;
    min-height: 90px;
}

.banner-slot-sidebar {
    width: 100%;
    min-height: 250px;
    display: block;
    margin-bottom: 16px;
}

/* ===== 注釈ツールチップ ===== */
.ref-link {
    display: inline;
    font-size: 11px;
    line-height: 1;
    vertical-align: super;
    color: var(--link);
    text-decoration: none;
    padding: 0 2px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.ref-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

/* PCのホバー吹き出し */
.ref-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    width: 260px;
    white-space: normal;
    word-break: break-all;
    z-index: 300;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    text-align: left;
    font-weight: normal;
    vertical-align: baseline;
}

.ref-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #555;
}

/* PCのみホバーで表示 */
@media (hover: hover) {
    .ref-link:hover .ref-tooltip {
        display: block;
    }
}

/* スマホ用ボトムシート */
.ref-bottom-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2a2a2a;
    border-top: 1px solid #555;
    border-radius: 12px 12px 0 0;
    padding: 20px 20px 40px;
    z-index: 1000;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.7);
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

.ref-bottom-sheet.open {
    transform: translateY(0);
}

.ref-bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: #666;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.ref-bottom-sheet-num {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.ref-bottom-sheet-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.ref-bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    transition: opacity 0.25s ease;
    opacity: 0;
}

.ref-bottom-sheet-overlay.open {
    opacity: 1;
}

/* YouTube埋め込み */
.youtube {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.youtube iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== スマホ版 h2 アコーディオン ===== */
@media (max-width: 768px) {
    .wiki-body h2 {
        cursor: pointer;
        user-select: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .accordion-arrow {
        font-size: 12px;
        color: var(--text-sub);
        transition: transform 0.3s ease;
        flex-shrink: 0;
        margin-left: 8px;
    }

    .wiki-body h2.accordion-open .accordion-arrow {
        transform: rotate(0deg);
    }

    .wiki-body h2:not(.accordion-open) .accordion-arrow {
        transform: rotate(-90deg);
    }

    .accordion-content {
        overflow: hidden;
    }
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
    :root {
        --header-h: 48px;
    }

    .site-wrapper {
        padding: 16px 12px 40px;
    }

    .header-octagon {
        width: 30px;
        height: 30px;
    }

    .header-section-name {
        font-size: 13px;
    }
}
