/* === カラーテーマの変数定義 === */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: rgba(255, 255, 255, 0.95);
    --border-color: #eaeaea;
    --code-bg: #f5f5f5;
    --details-border: #cccccc;
    --heading-color: #111111;
    --shadow-color: rgba(0,0,0,0.05);
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --discord-color: #5865F2;
    --youtube-color: #FF0000;
    --line-color: #06C755;
    --role-admin: #e74c3c;
    --role-helper: #2ecc71;
    --role-vip: #f39c12;
    --role-player: #3498db;
}

body.dark-mode {
    --bg-color: #0f1115;
    --text-color: #e0e0e0;
    --header-bg: rgba(15, 17, 21, 0.95);
    --border-color: #2a2e37;
    --code-bg: #1a1d24;
    --details-border: #444a56;
    --heading-color: #ffffff;
    --shadow-color: rgba(0,0,0,0.5);
    --accent-color: #3a86ff;
    --accent-hover: #2563eb;
}

body {
    background-color: var(--bg-color); 
    color: var(--text-color);
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    margin: 0; padding: 0;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.8;
    display: flex; flex-direction: column; min-height: 100vh;
}

/* ヘッダーとロゴ */
.fixed-header {
    position: fixed; top: 0; left: 0; width: 100%; height: 80px;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 999; display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px; box-sizing: border-box; transition: background-color 0.3s;
    border-bottom: 1px solid var(--border-color);
}
.text-logo {
    font-size: 1.8em; font-weight: 900; letter-spacing: 2px;
    color: var(--heading-color); text-decoration: none;
    background: linear-gradient(45deg, var(--accent-color), #00d2ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* シンプルなメニューボタン */
.menu-btn-wrapper {
    background-color: transparent;
    width: 40px; height: 40px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: opacity 0.2s;
}
.menu-btn-wrapper:hover { opacity: 0.6; }
.menu-btn { display: flex; flex-direction: column; justify-content: space-between; width: 28px; height: 20px; }
.menu-btn span { display: block; height: 2.5px; width: 100%; background-color: var(--heading-color); border-radius: 2px; transition: all 0.3s; }

/* サイドバー */
.sidebar {
    position: fixed; top: 0; right: -320px; width: 300px; height: 100vh;
    background-color: var(--header-bg); box-shadow: -5px 0 15px var(--shadow-color);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1001; padding: 30px; box-sizing: border-box;
    display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar.open { right: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border-color); padding-bottom: 15px; margin-bottom: 25px; }
.sidebar-header h2 { margin: 0; font-size: 1.3em; color: var(--accent-color); }
.close-btn { background: none; border: none; font-size: 2.5em; color: var(--text-color); cursor: pointer; line-height: 1; transition: transform 0.2s; }
.close-btn:hover { transform: scale(1.1); }
.sidebar-menu { list-style: none; padding: 0; margin: 0 0 30px 0; flex-grow: 1; }
.sidebar-menu li { margin-bottom: 15px; }
.sidebar-menu a { color: var(--text-color); text-decoration: none; font-size: 1.1em; font-weight: bold; display: block; padding: 12px 15px; border-radius: 8px; transition: background 0.2s; cursor: pointer; }
.sidebar-menu a:hover { background-color: var(--code-bg); color: var(--accent-color); }
.sidebar-settings { border-top: 2px solid var(--border-color); padding-top: 25px; }
.sidebar-settings h3 { margin-top: 0; font-size: 1.1em; margin-bottom: 10px; color: var(--heading-color); }
.sidebar-settings select { width: 100%; padding: 12px; font-size: 1em; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-color); outline: none; cursor: pointer; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; display: none; opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(3px); }
.sidebar-overlay.open { display: block; opacity: 1; }

/* ページコンテンツ */
.page-content { flex-grow: 1; padding-bottom: 60px; animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === ヒーローセクション === */
.hero { position: relative; height: 95vh; box-sizing: border-box; overflow: hidden; background-color: #000; }
.hero-slider { display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-behavior: smooth; -ms-overflow-style: none; scrollbar-width: none; }
.hero-slider::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; background-size: cover; background-position: center; position: relative; }
.slide::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(15,23,42,0.3) 0%, rgba(0,0,0,0.5) 100%); }
.hero-content { position: absolute; z-index: 10; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; padding: 20px; box-sizing: border-box; text-align: center; color: #ffffff; pointer-events: none; }
@keyframes fallDown { 0% { transform: translateY(-300px); opacity: 0; } 60% { transform: translateY(20px); opacity: 1; } 80% { transform: translateY(-10px); } 100% { transform: translateY(0); opacity: 1; } }
.hero-ruby { font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: bold; letter-spacing: 8px; color: #00d2ff; margin-bottom: -10px; opacity: 0; animation: fadeIn 1s ease forwards; animation-delay: 0.8s; text-shadow: 0 2px 5px rgba(0,0,0,0.8); }
.hero h1 { font-size: clamp(3rem, 10vw, 6rem); margin: 0 0 15px 0; text-shadow: 0 5px 20px rgba(0,0,0,0.9); font-weight: 900; letter-spacing: 4px; opacity: 0; animation: fallDown 1s cubic-bezier(0.25, 1, 0.5, 1) forwards; animation-delay: 0.2s; }
.hero p { font-size: clamp(1rem, 3vw, 1.3rem); margin: 0; text-shadow: 0 3px 10px rgba(0,0,0,0.9); font-weight: bold; letter-spacing: 1px; color: #eaeaea; opacity: 0; animation: fadeIn 1s ease forwards; animation-delay: 1.2s; }
.hero-status { margin-top: 40px; font-size: 1.2em; font-weight: bold; color: #ffffff; text-shadow: 0 2px 8px rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; gap: 10px; opacity: 0; animation: fadeIn 1s ease forwards; animation-delay: 2s; }
.status-dot { width: 14px; height: 14px; border-radius: 50%; background-color: gray; box-shadow: 0 0 8px gray; }
.status-dot.online { background-color: #28a745; box-shadow: 0 0 12px #28a745; animation: pulse 2s infinite; }
.status-dot.offline { background-color: #dc3545; box-shadow: 0 0 12px #dc3545; }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 12px rgba(40, 167, 69, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); } }

/* コンテンツ基本レイアウト */
.container { max-width: 900px; margin: 0 auto; padding: 60px 20px; }
.page-padding { padding-top: 100px; }
.section-title { color: var(--heading-color); font-size: 2em; margin-bottom: 50px; text-align: center; font-weight: bold; letter-spacing: 1px; }
.flat-section { margin-bottom: 60px; }
h3 { font-size: 1.4em; color: var(--heading-color); margin-top: 40px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid var(--border-color); padding-bottom: 8px; }
h3:first-child { margin-top: 0; }
h4 { color: var(--heading-color); font-size: 1.15em; margin: 25px 0 10px 0; display: flex; align-items: center;}
.svg-icon { width: 1.2em; height: 1.2em; fill: var(--heading-color); margin-right: 8px; vertical-align: -0.2em; }

/* 汎用UIパーツ */
.copy-btn { background-color: var(--code-bg); border: 1px solid var(--details-border); padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 0.9em; color: var(--text-color); font-weight: bold; transition: 0.2s; white-space: nowrap; }
.copy-btn:hover { background-color: var(--border-color); }
.auto-open-btn { display: inline-flex; align-items: center; justify-content: center; background-color: var(--accent-color); color: #ffffff; padding: 14px 20px; border-radius: 8px; text-decoration: none; font-weight: bold; transition: 0.2s; font-size: 1em; width: 100%; box-sizing: border-box; max-width: 400px; }
.auto-open-btn:hover { background-color: var(--accent-hover); transform: translateY(-2px); }
.code-box { background: var(--code-bg); padding: 10px 15px; border-radius: 6px; font-family: 'Consolas', monospace; color: var(--heading-color); border: 1px solid var(--border-color); font-size: 1.1em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 入力列レイアウト */
.input-group { margin-bottom: 25px; }
.input-label { display: block; font-size: 0.9em; color: var(--text-color); margin-bottom: 5px; opacity: 0.8; }
.input-row { display: flex; gap: 10px; align-items: center; max-width: 500px; }

/* ルール周り */
.warning-text { border-left: 4px solid #d9534f; padding: 5px 0 5px 15px; color: #d9534f; font-weight: bold; margin-bottom: 40px; font-size: 1.1em; }
.rules-list { padding-left: 0; margin-bottom: 30px; list-style: none; }
.rules-list li { margin-bottom: 15px; padding-left: 15px; border-left: 2px solid var(--border-color); color: var(--text-color); }
.rules-list strong { color: var(--heading-color); font-size: 1.05em; display: inline; }

/* Pointバッジ等 */
.feature-row { display: flex; align-items: center; gap: 40px; margin-bottom: 80px; }
.feature-row:nth-child(even) { flex-direction: row-reverse; }
.feature-badge { flex-shrink: 0; width: 80px; height: 80px; background-color: var(--bg-color); border: 2px solid var(--accent-color); border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--accent-color); }
.feature-badge span:first-child { font-size: 0.7em; font-weight: bold; margin-bottom: -5px; letter-spacing: 1px; }
.feature-badge span:last-child { font-size: 2em; font-weight: bold; line-height: 1; }
.feature-content { flex: 1; }
.feature-content h3 { font-size: 1.5em; margin: 0 0 15px 0; border: none; padding: 0; color: var(--heading-color); }
.feature-content p { font-size: 1.05em; color: var(--text-color); margin-bottom: 10px; opacity: 0.9; }
.feature-image { flex: 1; border-radius: 12px; overflow: hidden; background-color: var(--code-bg); aspect-ratio: 16 / 9; }
.feature-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* お知らせ一覧 */
.news-list { display: flex; flex-direction: column; }
.news-item { padding: 25px 0; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; }
.news-item:first-child { border-top: 1px solid var(--border-color); }
.news-header-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.news-date { font-size: 0.95em; color: var(--text-color); opacity: 0.8; }
.news-badge { background-color: var(--code-bg); border: 1px solid var(--details-border); color: var(--text-color); padding: 2px 12px; border-radius: 20px; font-size: 0.8em; font-weight: bold; }
.news-badge.emergency { background-color: rgba(217,83,79,0.1); border-color: #d9534f; color: #d9534f; }
.news-content { margin: 0; color: var(--heading-color); font-size: 1.05em; white-space: pre-wrap; line-height: 1.6; }
.no-news { text-align: center; color: var(--text-color); opacity: 0.6; padding: 30px; }

/* BANリスト & メンバー一覧共通 */
.search-wrapper { position: relative; margin-bottom: 30px; }
.search-wrapper svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: var(--text-color); opacity: 0.5; pointer-events: none; }
.search-box { width: 100%; padding: 16px 16px 16px 48px; font-size: 1em; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; background: var(--bg-color); color: var(--text-color); outline: none; transition: border-color 0.2s; }
.search-box:focus { border-color: var(--accent-color); }
.list-container { border-top: 2px solid var(--border-color); }
.list-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 0; border-bottom: 1px solid var(--border-color); gap: 15px; }
.list-info { flex: 1; }
.list-name { font-weight: bold; color: var(--heading-color); font-size: 1.15em; line-height: 1.2; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-desc { font-size: 0.95em; color: var(--text-color); opacity: 0.85; line-height: 1.5; }
.list-date { font-size: 0.9em; color: var(--text-color); opacity: 0.6; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }

/* 権限バッジ用 */
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75em; font-weight: bold; color: #fff; margin-bottom: 0; line-height: 1.2; }
.role-admin { background-color: var(--role-admin); }
.role-helper { background-color: var(--role-helper); }
.role-vip { background-color: var(--role-vip); color: #fff; }
.role-player { background-color: var(--role-player); color: #fff; }

/* 管理者画面 */
.admin-form { display: flex; flex-direction: column; gap: 15px; margin-bottom: 40px; }
.admin-form input, .admin-form textarea, .admin-form select { width: 100%; padding: 15px; font-size: 1em; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-color); box-sizing: border-box; font-family: inherit; }
.admin-form textarea { min-height: 120px; resize: vertical; }
.admin-btn { background: var(--accent-color); color: white; border: none; padding: 14px; font-size: 1em; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.admin-btn:hover { background: var(--accent-hover); }
.admin-controls { display: flex; gap: 10px; margin-top: 15px; }
.btn-edit, .btn-delete { color: white; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 0.9em; font-weight: bold; }
.btn-edit { background: #28a745; }
.btn-delete { background: #dc3545; }

/* Discord・WebMap 全画面用 */
.full-iframe-wrapper { flex-grow: 1; width: 100%; padding-top: 80px; box-sizing: border-box; background: var(--code-bg); display: flex; flex-direction: column; padding-bottom: 0;}
.full-iframe-wrapper iframe { width: 100%; height: 100%; min-height: calc(100vh - 80px); border: none; display: block; flex-grow: 1; }

/* === フッター === */
.site-footer { background-color: var(--bg-color); border-top: 1px solid var(--border-color); padding: 60px 5%; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; max-width: 1000px; margin: 0 auto; flex-wrap: wrap; gap: 40px; }
.footer-col { flex: 1; min-width: 250px; }
.footer-logo { font-size: 1.5em; font-weight: bold; color: var(--heading-color); text-decoration: none; margin-bottom: 10px; display: inline-block; cursor: pointer; }
.footer-logo::before { content: ''; display: inline-block; width: 16px; height: 16px; background-color: var(--accent-color); margin-right: 10px; vertical-align: middle; }
.copyright { margin-top: 5px; color: var(--text-color); font-size: 0.85em; opacity: 0.6; }
.footer-sns-left { display: flex; gap: 18px; margin-top: 25px; align-items: center; }
.footer-sns-left a { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; transition: transform 0.2s, box-shadow 0.2s; }
.footer-sns-left a:hover { transform: scale(1.1); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.footer-sns-left svg { width: 22px; height: 22px; fill: currentColor; }
.footer-nav-group { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-nav-col h4 { margin: 0 0 20px 0; color: var(--accent-color); font-size: 1em; font-weight: bold; border: none; }
.footer-nav-col ul { list-style: none; padding: 0; margin: 0; }
.footer-nav-col li { margin-bottom: 12px; }
.footer-nav-col a { color: var(--text-color); text-decoration: none; font-size: 0.95em; opacity: 0.8; transition: opacity 0.2s, color 0.2s; cursor: pointer; }
.footer-nav-col a:hover { opacity: 1; color: var(--accent-color); }

/* =========================================
   ★ Wiki ページ & エディターの完全統一スタイル ★
   ========================================= */
.wiki-article { margin-bottom: 50px; padding-bottom: 30px; border-bottom: 2px dashed var(--border-color); }
.wiki-article:last-child { border-bottom: none; }
.wiki-title { font-size: 2em; font-weight: bold; color: var(--heading-color); margin-top: 0; margin-bottom: 5px; line-height: 1.3; }
.wiki-date { font-size: 0.9em; color: var(--text-color); opacity: 0.6; margin-bottom: 25px; }

/* 記事とエディターの「見た目」を共通化 */
.wiki-content, .ql-editor { 
    color: var(--text-color); 
    line-height: 1.7; 
    overflow-wrap: break-word; 
    font-family: inherit; 
    font-size: 1.05em; 
}
/* 画像と文字の間隔をギュッと詰める */
.wiki-content img, .ql-editor img { 
    max-width: 100%; height: auto; border-radius: 8px; display: inline-block; 
    margin: 5px 0; /* 上下の余白を大幅に縮小 */
    vertical-align: bottom; 
}
.wiki-content h1, .ql-editor h1 { color: var(--heading-color); margin-top: 30px; margin-bottom: 10px; font-size: 1.8em; border-bottom: 2px solid var(--border-color); padding-bottom: 5px; }
.wiki-content h2, .ql-editor h2 { color: var(--heading-color); margin-top: 25px; margin-bottom: 10px; font-size: 1.5em; }
.wiki-content h3, .ql-editor h3 { color: var(--heading-color); margin-top: 20px; margin-bottom: 8px; font-size: 1.2em; }
.wiki-content p, .ql-editor p { margin-bottom: 8px; } /* 段落の隙間も縮小 */
.wiki-content a, .ql-editor a { color: var(--accent-color); text-decoration: underline; }

/* 文字サイズ・配置（Quill）の反映 */
.wiki-content .ql-size-small { font-size: 0.8em; }
.wiki-content .ql-size-large { font-size: 1.5em; }
.wiki-content .ql-size-huge { font-size: 2em; }
.wiki-content .ql-align-center { text-align: center; }
.wiki-content .ql-align-right { text-align: right; }
.wiki-content .ql-align-justify { text-align: justify; }

/* 目次・強調用の黒枠 */
.wiki-content blockquote, .ql-editor blockquote {
    border: 2px solid var(--heading-color);
    border-left: 2px solid var(--heading-color) !important;
    background-color: transparent;
    padding: 20px 25px;
    margin: 15px 0;
    border-radius: 0;
    font-style: normal;
    box-shadow: none;
}
.wiki-content blockquote h1, .wiki-content blockquote h2, .wiki-content blockquote h3,
.ql-editor blockquote h1, .ql-editor blockquote h2, .ql-editor blockquote h3 {
    color: #5bc0de !important; border-bottom: none; margin-top: 0; margin-bottom: 15px;
}
.wiki-content blockquote a, .ql-editor blockquote a { color: #777777 !important; text-decoration: underline !important; }
.wiki-content blockquote a:hover, .ql-editor blockquote a:hover { opacity: 0.7; }
.wiki-content blockquote ol, .wiki-content blockquote ul, .ql-editor blockquote ol, .ql-editor blockquote ul { padding-left: 25px; margin: 0; }
.wiki-content blockquote li, .ql-editor blockquote li { margin-bottom: 5px; font-size: 0.95em; color: var(--text-color); }
body.dark-mode .wiki-content blockquote, body.dark-mode .ql-editor blockquote { border-color: #666666; }

/* ★ 全画面エディター機能 ★ */
.editor-fullscreen {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw !important; height: 100vh !important;
    z-index: 10000;
    background: var(--bg-color) !important;
    border: none !important; border-radius: 0 !important;
}
.editor-fullscreen .ql-toolbar {
    border-top: none !important; border-left: none !important; border-right: none !important;
    padding: 10px 20px !important;
    background: var(--code-bg);
}
.editor-fullscreen .ql-container {
    flex-grow: 1; height: calc(100vh - 60px) !important; border: none !important;
}
.editor-fullscreen .ql-editor {
    /* 実際の公開画面と全く同じ横幅にしてプレビューを完全再現 */
    max-width: 900px !important; 
    margin: 0 auto;
    padding: 40px 20px !important;
    min-height: 100%;
}

/* スマホ用メディアクエリ */
@media (max-width: 768px) {
    .container { padding: 40px 20px; }
    .page-padding { padding-top: 80px; }
    .section-title { font-size: 1.6em; margin-bottom: 30px; }
    .feature-row, .feature-row:nth-child(even) { flex-direction: column; text-align: left; gap: 20px; margin-bottom: 50px; }
    .feature-badge { width: 60px; height: 60px; margin-bottom: 10px; }
    .feature-badge span:last-child { font-size: 1.5em; }
    .feature-content h3 { font-size: 1.3em; }
    .input-row { flex-direction: column; align-items: stretch; }
    .copy-btn { padding: 12px; text-align: center; }
    .list-item { flex-direction: column; gap: 8px; }
    .list-date { margin-left: 0; align-self: flex-start; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 40px; }
    .footer-nav-group { flex-direction: column; gap: 30px; width: 100%; }
    .footer-nav-col { width: 100%; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }

    /* ★ スマホでのWiki見栄え調整（余白や文字をコンパクトに） */
    .wiki-content h1, .ql-editor h1 { font-size: 1.5em; }
    .wiki-content h2, .ql-editor h2 { font-size: 1.3em; }
    .wiki-content h3, .ql-editor h3 { font-size: 1.1em; }
    .wiki-content blockquote, .ql-editor blockquote { padding: 15px; margin: 10px 0; }
    .wiki-article { padding-bottom: 20px; margin-bottom: 30px; }
    .editor-fullscreen .ql-editor { padding: 20px 10px !important; }
}