/* メイン CSS - 全体の基本スタイル */

/* 基本リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #0f0f1a;
    color: #f0f0f0;
    overflow: hidden; /* スクロールバーを非表示 */
}

/* ★[FIX] 各ビューコンテナの基本スタイル */
#worldViewContainer,
#locationViewContainer,
#storySelectContainer {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: none; /* ★[ADD] デフォルトは非表示 */
}

/* ★[ADD] 表示状態を制御するクラス */
#worldViewContainer.active,
#locationViewContainer.active,
#storySelectContainer.active {
    display: block;
}

/* 基本ボタンスタイル */
.btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #357abd;
}

/* ★[FIX] キャラクターシンボル用スタイル */
.character-symbol {
    position: absolute;
    z-index: 20;
}

/* ★[FIX] ロケーションアイコン用スタイル */
.location-icon {
    position: absolute;
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 15;
}

.location-icon:hover {
    transform: scale(1.1);
    background: rgba(0,0,0,0.8);
}

.location-icon i {
    font-size: 16px;
}

/* 環境要素用スタイル */
.environment-element {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    z-index: 10;
}

.environment-element:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* 入力フィールドスタイル */
input[type="text"] {
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* UIオーバーレイ */
#uiOverlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.ui-button {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ui-button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* ★ [NEW] ストーリーモード開始ボタン */
.story-mode-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 60px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1001;
}

.story-mode-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* ★ [REFACTORED] 新しいクラス名に合わせたモーダルスタイル */
.modal-overlay {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #1a1a2e;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: #fff;
    text-decoration: none;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #e0e0e0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #c0c0c0;
    font-weight: bold;
}

.form-group select {
    width: 100%;
    padding: 10px;
    background: #2a2a3e;
    border: 1px solid #444;
    color: #f0f0f0;
    border-radius: 5px;
    font-family: 'Noto Sans JP', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.modal-submit-button {
    width: 100%;
    padding: 12px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.modal-submit-button:hover {
    background-color: #357ABD;
}

/* World Map Enhancements */
.map-container {
    position: relative; /* 子要素の絶対位置指定の基準点とする */
    width: 100%;
    max-width: 1280px; /* Adjust as needed */
    margin: auto;
    line-height: 0; /* img下の余分なスペースを削除 */
}

.world-map-image {
    width: 100%;
    height: auto;
    display: block; /* img下の余分なスペースを削除 */
}

.symbols-overlay {
    position: absolute; /* 親コンテナ(map-container)を基準に配置 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 下のマップ画像を操作できるように */
}

.map-symbol {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 8px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    pointer-events: auto; /* シンボル自体はクリックできるように */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap; /* テキストの折り返しを防ぐ */
}

.map-symbol:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    z-index: 10;
}

.map-symbol img {
    width: 20px;
    height: 20px;
}

.character-symbol img {
    border-radius: 50%;
    border: 1px solid #fff;
}

/* ★★★ [NEW] 次世代ワールド生成 同意確認モーダル関連のスタイル ★★★ */
.modal-cancel-button {
    padding: 10px 20px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.modal-cancel-button:hover {
    background-color: #555;
}

.location-tooltip {
    /* ... (existing styles) ... */
}

/* ▼▼▼ [v30] 次世代ワールド生成用モーダルスタイル ▼▼▼ */
.gw-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.gw-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    color: #333;
}
.gw-modal-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
}
.gw-modal-text {
    margin-bottom: 25px;
    font-size: 1em;
    line-height: 1.6;
}
.gw-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.gw-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
}
.gw-btn-primary {
    background-color: #4A90E2;
    color: white;
}
.gw-btn-primary:hover {
    background-color: #357ABD;
}
.gw-btn {
    background-color: #e0e0e0;
    color: #333;
}
.gw-btn:hover {
    background-color: #c7c7c7;
}
/* ▲▲▲ [v30] 次世代ワールド生成用モーダルスタイル ▲▲▲ */ 

/* ==================================================================
   ★ [NEW] 13. ワールドマップUI (World Map UI)
   ================================================================== */
.world-map-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #0a0a1a; /* Dark blue-ish background */
}

.world-map-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画像がコンテナにフィットするように */
}

.map-symbol {
    position: absolute;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 99, 71, 0.85); /* Tomato color with transparency */
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.map-symbol:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: rgba(255, 99, 71, 1); /* ホバー時に不透明に */
}


/* ==================================================================
   ★ [NEW] 14. ロケーションビュー (Location View)
   ================================================================== */

.location-view-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* 上から配置 */
    width: 100%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    color: white;
    background: rgba(10, 20, 40, 0.85); /* 半透明の濃い青背景 */
    backdrop-filter: blur(10px);
    overflow-y: auto; /* 内容が多い場合にスクロール */
    text-align: center;
}

.location-title {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.location-description {
    font-size: 1.1em;
    max-width: 800px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.landmarks-header {
    font-size: 1.8em;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 10px;
}

.landmarks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 700px;
    text-align: left;
}

.landmark-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s, transform 0.3s;
}

.landmark-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.landmark-name {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.landmark-description {
    font-size: 1em;
    margin: 0;
    color: #e0e0e0;
}

.back-to-map-button {
    margin-top: 30px;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-to-map-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
} 

/* ================================================================== */
/* ★ [NEW] ロケーション情報パネル (2025/07/12)
/* ================================================================== */
.location-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 40px);
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 15; /* 10から15に変更 */
    overflow-y: auto;
    font-family: 'Noto Sans JP', sans-serif;
}

.location-title {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #4ac7ff;
    border-bottom: 1px solid #4ac7ff;
    padding-bottom: 5px;
}

.location-description {
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 20px;
}

.landmark-title {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #ffc107;
}

.landmark-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.landmark-item {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.landmark-item:hover {
    background-color: rgba(74, 199, 255, 0.3);
    transform: translateX(5px);
}

.no-landmarks {
    color: #aaa;
    font-style: italic;
}

/* ================================================================== */
/* ★ [NEW] キャラクター立ち絵 (v4)
/* ================================================================== */
.character-standing-container {
    position: absolute;
    bottom: 0;
    left: 20%; /* 50pxから20%に変更 - より中央寄りに */
    width: 40%; /* 画面幅の40% */
    height: 90vh; /* 画面の高さの90% */
    z-index: 10; /* 5から10に変更 - 背景画像の上に表示 */
    pointer-events: none; /* クリックイベントを透過させる */
    transition: opacity 0.5s ease-in-out;
    opacity: 0; /* 初期状態では非表示 */
}

.character-standing-container.visible {
    opacity: 1; /* 表示状態 */
}

.character-standing-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* アスペクト比を維持してコンテナに収める */
    object-position: bottom center; /* bottom leftからbottom centerに変更 */
}

/* ================================================================== */
/* ★ [NEW] キャラクター表示コンテナ (2025/07/12)
/* ================================================================== */
#character-display-container {
    position: absolute;
    bottom: 0;
    left: 20%; /* 50pxから20%に変更 - より中央寄りに */
    width: 40%;
    height: 90vh;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    justify-content: center; /* flex-startからcenterに変更 */
}

#character-display-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: bottom center; /* bottom leftからbottom centerに変更 */
}

/* ================================================================== */
/* ★ [FIX] 背景画像表示のための必須CSS (2025/07/12)
/* ================================================================== */
#location-background-container {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* -1から1に変更 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    pointer-events: none;
    /* デバッグ用: 背景が設定されていることを確認 */
    border: 2px solid red;
    background-color: rgba(255, 0, 0, 0.1);
}

#locationViewContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: block;
    opacity: 1;
}

/* ================================================================== */
/* ★ [NEW] 行先リストのスタイル (2025/07/12) - タブ付きフローティング表示
/* ================================================================== */
#destination-list-container {
    position: fixed; /* absoluteからfixedに変更 */
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    color: #fff;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    font-family: 'Noto Sans JP', sans-serif;
    overflow: hidden;
    transition: all 0.3s ease;
    transform: translateX(0);
}

#destination-list-container.minimized {
    transform: translateX(calc(100% - 50px));
}

/* タブヘッダー */
.destination-tabs {
    display: flex;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.destination-tab {
    flex: 1;
    padding: 12px 15px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.destination-tab.active {
    color: #4ac7ff;
    background-color: rgba(74, 199, 255, 0.1);
}

.destination-tab:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.destination-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #4ac7ff;
}

/* タブコンテンツ */
.destination-tab-content {
    display: none;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.destination-tab-content.active {
    display: block;
}

/* 最小化ボタン */
.destination-minimize-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.destination-minimize-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* リストアイテム */
.destination-list h3 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 15px;
    color: #4ac7ff;
    border-bottom: 1px solid #4ac7ff;
    padding-bottom: 5px;
}

.destination-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.destination-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.destination-item:hover {
    background-color: rgba(74, 199, 255, 0.2);
    transform: translateX(5px);
    border-color: rgba(74, 199, 255, 0.3);
}

.destination-icon {
    font-size: 1.2em;
    min-width: 20px;
    text-align: center;
}

.destination-content {
    flex: 1;
    min-width: 0;
}

.destination-name {
    font-weight: 600;
    font-size: 0.95em;
    color: #fff;
    margin-bottom: 2px;
    display: block;
}

.destination-description {
    font-size: 0.8em;
    color: #ccc;
    line-height: 1.3;
}

/* ランドマークアイテム */
.landmark-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.landmark-item:hover {
    background-color: rgba(255, 193, 7, 0.2);
    transform: translateX(5px);
    border-color: rgba(255, 193, 7, 0.3);
}

.landmark-icon {
    font-size: 1.2em;
    min-width: 20px;
    text-align: center;
    color: #ffc107;
}

.landmark-content {
    flex: 1;
    min-width: 0;
}

.landmark-name {
    font-weight: 600;
    font-size: 0.95em;
    color: #fff;
    margin-bottom: 2px;
    display: block;
}

.landmark-description {
    font-size: 0.8em;
    color: #ccc;
    line-height: 1.3;
} 

/* ================================================================== */
/* ★ [NEW] ランドマーク詳細パネル (右側フローティング) */
#landmark-detail-panel {
    position: fixed;
    top: 40px;
    right: 30px;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    background: rgba(30, 34, 50, 0.98);
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 2001;
    padding: 32px 28px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    border: 1.5px solid #4ac7ff;
    animation: fadeIn 0.2s;
}
#landmark-detail-panel .close-btn {
    position: absolute;
    top: 12px;
    right: 18px;
    background: none;
    border: none;
    color: #4ac7ff;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 2010;
    transition: color 0.2s;
}
#landmark-detail-panel .close-btn:hover {
    color: #ff9800;
}
#landmark-detail-panel h2 {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    color: #4ac7ff;
    border-bottom: 1px solid #4ac7ff;
    padding-bottom: 5px;
}
#landmark-detail-panel .landmark-description {
    font-size: 1em;
    color: #fff;
    margin-bottom: 10px;
}
#landmark-detail-panel .subarea-list {
    margin-top: 10px;
    padding-left: 0;
    list-style: none;
}
#landmark-detail-panel .subarea-item {
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 10px 14px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
#landmark-detail-panel .subarea-item:hover {
    background: #4ac7ff;
    color: #222;
}

/* チャットUIが常に最前面 */
#novelChatContainer {
    z-index: 3000 !important;
} 