/* style.css */
:root {
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --border-color: #30363d;
    --text-main: #c9d1d9;
    --accent-danger: #ff7b72;
    --accent-info: #58a6ff;
    --accent-safe: #3fb950;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Courier New', Consolas, monospace;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ヘッダーとナビゲーション周り */
.dashboard-container, .nav-bar, .content-split, .timeline-container {
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

h1 {
    color: var(--accent-danger);
    margin: 0;
    letter-spacing: 2px;
    font-size: 1.8em;
}

/* =========================================
   モダン言語セレクタ（枠線なし・地球儀スタイル）
   ========================================= */
.lang-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8b949e; /* 普段は控えめなグレー */
    transition: color 0.2s ease;
}

/* マウスが乗った時に全体が青く光る */
.lang-menu:hover {
    color: var(--accent-info);
}

.lang-icon {
    font-size: 1.2em;
    pointer-events: none; /* アイコン上でもクリックが貫通するように */
}

.lang-selector {
    appearance: none; /* ブラウザ標準の枠と矢印を消去 */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: transparent;
    color: inherit; /* hover時に親と一緒に色が変わる */
    border: none;
    font-family: inherit;
    font-weight: bold;
    font-size: 1em;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    padding-right: 15px; /* カスタム矢印用のスペース */
}

/* カスタムの小さな矢印 */
.lang-menu::after {
    content: '▼';
    font-size: 0.6em;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* ドロップダウンを開いたときのリストの背景色 */
.lang-selector option {
    background-color: var(--panel-bg);
    color: var(--text-main);
    font-weight: bold;
}

.nav-link {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}
.nav-link a, .nav-bar a {
    color: var(--accent-info);
    text-decoration: none;
    font-weight: bold;
    margin-left: 20px;
}
.nav-link a:hover, .nav-bar a:hover {
    text-decoration: underline;
}

/* パネルとレイアウト */
.top-row { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    box-sizing: border-box;
}

/* ダッシュボード固有: 時計 */
.clock-panel { flex: 1; min-width: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.clock-container { width: 200px; height: 200px; position: relative; margin: 20px 0; border-radius: 50%; box-shadow: 0 0 20px rgba(255, 123, 114, 0.2); }
.clock-svg { width: 100%; height: 100%; }
.hand-minute { stroke: var(--accent-danger); stroke-width: 3; stroke-linecap: round; transform-origin: 100px 100px; transition: transform 1s cubic-bezier(0.4, 2.0, 0.2, 1); filter: drop-shadow(0 0 5px var(--accent-danger)); }
.hand-hour { stroke: #8b949e; stroke-width: 5; stroke-linecap: round; transform-origin: 100px 100px; transform: rotate(-15deg); }
.digital-time { font-size: 1.5em; font-weight: bold; color: var(--accent-danger); }
.tension-label { font-size: 1.1em; color: var(--accent-info); margin-top: 5px; }

/* ダッシュボード固有: グラフとリスト */
.chart-panel { flex: 2; min-width: 400px; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-item { border-bottom: 1px solid var(--border-color); padding: 15px 0; display: flex; gap: 15px; align-items: flex-start; }
.event-item:last-child { border-bottom: none; }
.event-image { width: 120px; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border-color); background-color: #000; flex-shrink: 0; }
.event-content { flex: 1; }
.event-header { display: flex; justify-content: space-between; margin-bottom: 5px; }

/* バッジとアコーディオン */
.badge { padding: 2px 8px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }
.badge.up { background-color: rgba(255, 123, 114, 0.2); color: var(--accent-danger); border: 1px solid var(--accent-danger); }
.badge.down { background-color: rgba(63, 185, 80, 0.2); color: var(--accent-safe); border: 1px solid var(--accent-safe); }
.badge.keep { background-color: rgba(139, 148, 158, 0.2); color: #8b949e; border: 1px solid #8b949e; }

details { background-color: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 10px 20px; margin-top: 20px; cursor: pointer; }
summary { font-weight: bold; color: var(--accent-info); outline: none; padding: 10px 0; }

/* 年表・地図ページ固有 */
.timeline-container { overflow-x: auto; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 20px; white-space: nowrap; margin-bottom: 20px; position: relative; }

/* =========================================
   タイムラインコンテナのカスタムスクロールバー
   ========================================= */

/* Firefox向けの細いスクロールバー設定 */
.timeline-container {
    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;
}

/* Webkit (Chrome, Safari, Edge)向けのカスタマイズ */
.timeline-container::-webkit-scrollbar {
    height: 6px; /* 横スクロールバーの太さを極細(6px)にする */
}

/* スクロールの背景（トラック） */
.timeline-container::-webkit-scrollbar-track {
    background: transparent; 
    border-radius: 4px;
}

/* スクロールのつまみ（サム） */
.timeline-container::-webkit-scrollbar-thumb {
    background-color: transparent; /* デフォルトは透明にして隠蔽 */
    border-radius: 4px;
}

/* コンテナにマウスが乗った時だけつまみを表示 */
.timeline-container:hover::-webkit-scrollbar-thumb {
    background-color: #30363d; /* 控えめなラインとして表示 */
}

/* つまみ自体をホバー/ドラッグした時はアクセントカラーで強調 */
.timeline-container::-webkit-scrollbar-thumb:hover,
.timeline-container::-webkit-scrollbar-thumb:active {
    background-color: var(--accent-info); /* 操作中は青く光らせる */
}

/* =========================================
   年表アイテムのスタイル
   ========================================= */
.timeline-item { 
    display: inline-block; 
    width: 100px; 
    text-align: center; 
    cursor: pointer; 
    position: relative; 
    opacity: 0.5; 
    transition: all 0.3s; 
}
.timeline-item:hover, .timeline-item.active { opacity: 1; }

/* 1. テキストの強調（全体をscaleさせるのをやめ、文字の光彩で強調） */
.timeline-item.active { 
    color: var(--accent-danger); 
    font-weight: bold; 
    text-shadow: 0 0 8px rgba(255, 123, 114, 0.5);
}

/* 2. 年表の丸（ドット） - 基本色 */
.timeline-item::after { 
    content: ''; display: block; width: 10px; height: 10px; 
    background: #8b949e; /* デフォルトはニュートラル */
    border-radius: 50%; margin: 10px auto 0; position: relative; z-index: 2; transition: all 0.3s;
}

/* タイプ別の色設定 */
.timeline-item.type-up::after { background: var(--accent-danger); }   /* 緊迫化は赤 */
.timeline-item.type-down::after { background: var(--accent-safe); }   /* 緩和は緑 */
.timeline-item.type-keep::after { background: #8b949e; }              /* 維持はグレー */

/* アクティブ時の光彩効果（赤系で統一しても良いですし、ここもタイプ別にするなら更に細かく指定可能） */
.timeline-item.active::after { 
    transform: scale(1.5);
    box-shadow: 0 0 10px currentColor; /* 現在の色(background)を影に適用 */
}

/* 4. ノード同士を繋ぐ線（未来/右に向かって引く） */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 32px;   /* 丸の高さの中央 */
    left: 50%;   /* 自分の中心からスタート */
    width: 100%; /* 次のアイテムの中心まで届かせる */
    height: 2px;
    background: var(--border-color);
    z-index: 1;  /* 丸(z-index:2)の後ろに配置 */
}

/* 最後のアイテムは未来への線を引かない */
.timeline-item:last-child::before { 
    display: none; 
}

.content-split { display: flex; gap: 20px; flex-wrap: wrap; }
.detail-panel { flex: 1; min-width: 300px; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 20px; }
.map-panel { flex: 2; min-width: 400px; height: 500px; background: #000; border: 1px solid var(--border-color); border-radius: 6px; position: relative; }
#worldMap { width: 100%; height: 100%; border-radius: 5px; }

.detail-image { 
    width: 100%; 
    height: auto;
    aspect-ratio: 4 / 3; /* ここでアスペクト比を固定（16 / 9 などに変更可能） */
    object-fit: contain; /* 画像を切り取らずに全体を収める */
    background-color: #0d1117; /* 余白ができた場合の背景色 */
    border-radius: 4px; 
    margin-bottom: 15px; 
    border: 1px solid var(--border-color); 
}
.detail-year { font-size: 2em; color: var(--accent-danger); margin: 0 0 10px 0; }
.detail-stats { color: var(--accent-info); font-size: 0.9em; margin-bottom: 15px; }


/* =========================================
   引用文モジュール (B案: ドキュメンタリー風)
   ========================================= */
.extra-content-panel {
    display: flex;
    gap: 20px;
    padding: 25px;
    background: linear-gradient(to right, rgba(22, 27, 34, 0.8), var(--panel-bg));
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-info);
    border-radius: 4px;
    margin-top: 20px;
    align-items: center;
    min-height: 120px; /* 高さを確保してガタつきを防止 */
}

.extra-content-panel .quote-icon {
    font-size: 4em;
    color: var(--border-color);
    line-height: 1;
    font-family: 'Times New Roman', Times, serif;
    margin-top: -10px;
}

.extra-content-panel .quote-content {
    flex: 1;
}

.extra-content-panel .quote-text {
    margin: 0 0 10px 0;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-main);
    font-size: 1.05em;
}

.extra-content-panel .quote-author {
    color: #8b949e;
    font-size: 0.9em;
}

/* 広告欄 ========================== */
/* 広告枠のスタイル */
.ad-placeholder {
    background-color: #161b22;
    border: 2px dashed #30363d;
    color: #8b949e;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
    border-radius: 6px;
    font-size: 0.8em;
}

.ad-container-footer {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto 20px;
    display: flex;
    justify-content: center;
}
.ad-placeholder-long {
    width: 100%;
    max-width: 728px; /* 標準的なバナーサイズ */
    height: 90px;
    background-color: var(--panel-bg);
    border: 1px dashed #30363d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #30363d;
}
/* ================================= */


/* 地図の下の汎用コンテナ用スタイル */
.extra-content-panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
    min-height: 150px; /* 何もなくても場所を確保 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #30363d;
    border: 2px dashed #30363d; /* プレースホルダーであることが分かるように */
}

/*フッター要素================*/
/* フッターのスタイル */
.site-footer {
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #8b949e;
    font-size: 0.85em;
}

.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-right { display: flex; gap: 20px; }
.footer-right a { color: #8b949e; text-decoration: none; }
.footer-right a:hover { color: var(--accent-info); text-decoration: underline; }

/* アイコン用（とりあえずはテキストや絵文字で代用） */
.footer-icon { font-size: 1.5em; }

