/* Pattern 4: オーバーレイチャット - モノクロデザイン */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border: #cccccc;
    --accent: #333333;
    --hover: #e0e0e0;

    /* iOS 26 Glassmorphism - 高透過度 */
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-bg-light: rgba(255, 255, 255, 0.35);
    --glass-bg-dark: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-border-subtle: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-shadow-intense: 0 12px 48px rgba(0, 0, 0, 0.15);
    --glass-blur: 16px;
    --glass-blur-light: 10px;
    --glass-radius: 16px;
    --glass-radius-sm: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    overflow: hidden;
}

/* 地図（全画面背景） */
.map-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Leafletスタイルカスタマイズ */
.leaflet-container {
    background: #e0e0e0;
    font-family: 'Rajdhani', sans-serif;
}

.leaflet-popup-content-wrapper {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--glass-radius-sm);
    color: #ffffff;
}

.leaflet-popup-content {
    color: #ffffff;
    margin: 12px 16px;
}

.leaflet-popup-content h3 {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content p {
    color: rgba(255, 255, 255, 0.9);
}

.leaflet-popup-tip {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    box-shadow: none;
}

.leaflet-control-zoom a {
    background: var(--glass-bg-light);
    color: var(--accent);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.8);
}

.municipality-tooltip {
    background: var(--glass-bg-light);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
    box-shadow: var(--glass-shadow);
}

/* 黒系glassmorphismツールチップ（ホバー時） */
.municipality-tooltip.glass-tooltip {
    background: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ヘッダー（固定） - Glassmorphism */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 5px 20px;
    padding: 15px 25px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.app-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    grid-column: 1;
    grid-row: 1;
}

.region {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

.tagline {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
    letter-spacing: 0.3px;
    grid-column: 1;
    grid-row: 2;
}

.header-controls {
    display: flex;
    gap: 10px;
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
}

/* ナビゲーションリンク */
.nav-link {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(74, 144, 226, 0.5);
}

/* ヘッダー内のAboutリンク（タイトル横） */
.nav-link-header {
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    padding: 4px 12px;
    margin-left: 15px;
    vertical-align: middle;
}

.control-select {
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.control-select:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
}

/* 浮遊パネル共通スタイル - Glassmorphism */
.floating {
    position: fixed;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius);
    box-shadow:
        var(--glass-shadow),
        inset 0 0 0 1px var(--glass-border-subtle);
    z-index: 10;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border-subtle);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--glass-radius) var(--glass-radius) 0 0;
}

.panel-header h2,
.panel-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.minimize-btn,
.close-btn,
.reset-chat-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.reset-chat-btn {
    font-size: 16px;
    margin-right: 5px;
}

/* 会話履歴コントロール */
.chat-history-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 12px;
    width: auto;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.history-select option {
    background: #ffffff;
    color: #333333;
}

.new-chat-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--accent-color);
}

.minimize-btn:hover,
.close-btn:hover,
.reset-chat-btn:hover {
    color: var(--text-primary);
}

.panel-body {
    padding: 20px;
}

/* チャットパネル（フローティング） - Glassmorphism */
.chat-panel {
    top: 100px;
    left: 20px;
    width: 360px;
    height: calc(100vh - 100px - 60px);
    display: flex;
    flex-direction: column;
    border-radius: var(--glass-radius);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--glass-shadow),
        inset 0 0 0 1px var(--glass-border-subtle);
    background: var(--glass-bg-light);
}

.chat-panel .panel-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.quick-questions {
    margin-bottom: 15px;
    padding: 8px;
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--glass-radius-sm);
    background: rgba(255, 255, 255, 0.15);
}

/* プルダウンメニュー形式のクイック質問 */
.question-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

.question-select:hover {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(74, 144, 226, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.question-select:focus {
    outline: none;
    border-color: rgba(74, 144, 226, 0.6);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.question-select optgroup {
    font-weight: 600;
    color: #333;
    background: #f5f5f5;
    padding: 4px 0;
}

.question-select option {
    padding: 8px 12px;
    font-weight: 400;
    color: #444;
}

/* 旧ボタン形式（互換性のため残す） */
.question-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 8px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.question-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--glass-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 200px;
}

.message {
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--glass-radius-sm);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
}

.message.user {
    background: rgba(74, 144, 226, 0.12);
    border-color: rgba(74, 144, 226, 0.25);
}

.message.bot {
    background: rgba(255, 255, 255, 0.35);
}

.input-area {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.35);
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(74, 144, 226, 0.5);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.send-btn {
    width: 40px;
    padding: 10px;
    background: rgba(51, 51, 51, 0.8);
    color: white;
    border: none;
    border-radius: var(--glass-radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.send-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* LLMステータスバー */
.llm-status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--glass-radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border-subtle);
}

.llm-status-icon {
    font-size: 12px;
}

.llm-status-text {
    font-weight: 500;
}

/* ステータス: 接続中 */
.llm-status-bar.connected {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.3);
    color: #27ae60;
}

/* ステータス: 起動待ち */
.llm-status-bar.starting {
    background: rgba(241, 196, 15, 0.15);
    border-color: rgba(241, 196, 15, 0.3);
    color: #f39c12;
}

/* ステータス: フォールバック */
.llm-status-bar.fallback {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
    color: #2980b9;
}

/* ステータス: エラー */
.llm-status-bar.error {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.3);
    color: #c0392b;
}

/* ステータス: 考え中 */
.llm-status-bar.thinking {
    background: rgba(255, 193, 7, 0.35);
    border-color: rgba(255, 152, 0, 0.5);
    color: #e65100;
}

.llm-status-bar.thinking .llm-status-icon {
    animation: statusThinkingPulse 1.5s ease-in-out infinite;
}

@keyframes statusThinkingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* グラフパネル（右下） - Glassmorphism */
.chart-panel {
    bottom: 60px;
    right: 20px;
    width: 480px;
    background: var(--glass-bg-light);
    transition: width 0.3s ease, height 0.3s ease;
}

/* 拡大表示状態 */
.chart-panel.expanded {
    width: 1000px;
}

.chart-panel.expanded .chart-container {
    height: 480px;
}

.chart-panel.expanded .expand-btn {
    transform: rotate(180deg);
}

/* パネルヘッダーのコントロールボタン群 */
.panel-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 拡大ボタン */
.expand-btn {
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid rgba(74, 144, 226, 0.4);
    color: var(--accent-primary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: rgba(74, 144, 226, 0.35);
    border-color: var(--accent-primary);
    transform: scale(1.1);
}

/* CSVダウンロードボタン */
.download-csv-btn {
    background: rgba(75, 192, 192, 0.2);
    border: 1px solid rgba(75, 192, 192, 0.4);
    color: rgb(75, 192, 192);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.download-csv-btn:hover {
    background: rgba(75, 192, 192, 0.35);
    border-color: rgb(75, 192, 192);
    transform: scale(1.1);
}

/* 指標切替UI（時系列グラフ用） */
.metric-switcher {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--glass-radius-sm);
    border: 1px solid var(--glass-border-subtle);
}

.metric-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 6px;
    font-size: 11px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.metric-btn:hover {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(74, 144, 226, 0.4);
    color: var(--text-primary);
}

.metric-btn.active {
    background: rgba(74, 144, 226, 0.25);
    border-color: rgba(74, 144, 226, 0.6);
    color: rgba(74, 144, 226, 1);
}

/* グラフコンテナ - Glassmorphism */
.chart-container {
    position: relative;
    padding: 15px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--glass-radius-sm);
    margin-bottom: 15px;
    height: 240px;
}

.chart-container canvas {
    max-height: 100%;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--glass-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 統計パネル（右上） - Glassmorphism */
.stats-panel {
    top: 110px;
    right: 20px;
    width: 200px;
    background: var(--glass-bg-light);
}

.stat-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border-subtle);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* 透明モードボタン - Glassmorphism */
.transparency-btn {
    bottom: 80px;
    left: 20px;
    padding: 12px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
}

.transparency-btn:hover {
    background: var(--glass-bg-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 透明モードモーダル - Glassmorphism */
.transparency-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.transparency-modal.hidden {
    display: none;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-shadow-intense);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--glass-border-subtle);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--glass-radius) var(--glass-radius) 0 0;
}

.modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.close-modal {
    width: 35px;
    height: 35px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-body h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    letter-spacing: 0.5px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    line-height: 1.8;
}

/* フッター - Glassmorphism */
.attribution {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    z-index: 50;
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
    box-shadow: var(--glass-shadow);
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .stats-panel {
        display: none;
    }

    .chart-panel {
        width: 400px;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .app-header h1 {
        font-size: 18px;
    }

    .chat-panel {
        width: calc(100% - 40px);
        left: 20px;
        top: 100px;
        height: 35vh;
    }

    .chart-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 70px;
    }

    .transparency-btn {
        top: auto;
        bottom: 70px;
        right: 20px;
        left: auto;
        width: auto;
    }

    .attribution {
        bottom: 15px;
    }
}

/* ================================
   デバッグパネル
   ================================ */
.debug-panel {
    position: fixed;
    bottom: 50px;
    left: 400px;
    width: 500px;
    max-height: 600px;
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 999;
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #ff6b6b;
    color: white;
    border-radius: 6px 6px 0 0;
    border-bottom: 2px solid #ff5252;
}

.debug-header h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

.debug-controls {
    display: flex;
    gap: 5px;
}

.debug-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debug-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.debug-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.debug-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debug-tab:hover {
    background: rgba(255, 107, 107, 0.05);
    color: #333;
}

.debug-tab.active {
    color: #ff6b6b;
    border-bottom-color: #ff6b6b;
    background: white;
}

.debug-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fafafa;
}

.debug-content {
    display: none;
    position: relative;
}

.debug-content.active {
    display: block;
}

.debug-content pre {
    margin: 0;
    padding: 15px;
    background: #2d2d2d;
    color: #f8f8f2;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 450px;
    overflow-y: auto;
}

.debug-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debug-copy:hover {
    background: white;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* モデル選択UI */
.model-selector {
    margin: 15px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border: 1px solid #ddd;
}

.model-selector label {
    display: block;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-selector label:hover {
    border-color: #4a90e2;
    background: rgba(74, 144, 226, 0.05);
}

.model-selector label:has(input:checked) {
    border-color: #4a90e2;
    background: rgba(74, 144, 226, 0.1);
}

.model-selector input[type="radio"] {
    margin-right: 8px;
}

.model-selector strong {
    color: #333;
    font-size: 14px;
}

.model-desc {
    font-size: 11px;
    color: #666;
    margin-left: 22px;
}

.model-apply-btn {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.model-apply-btn:hover:not(:disabled) {
    background: #357abd;
}

.model-apply-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#debugModel hr {
    margin: 15px 0;
    border: none;
    border-top: 1px solid #ddd;
}

#debugModel h4 {
    margin-bottom: 10px;
    color: #333;
}

/* スクロールバーのスタイル */
.debug-body::-webkit-scrollbar,
.debug-content pre::-webkit-scrollbar {
    width: 8px;
}

.debug-body::-webkit-scrollbar-track,
.debug-content pre::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.debug-body::-webkit-scrollbar-thumb,
.debug-content pre::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.debug-body::-webkit-scrollbar-thumb:hover,
.debug-content pre::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    /* ヘッダー */
    .app-header {
        font-size: 14px;
    }

    .app-header h1 {
        font-size: 18px;
    }

    /* サイドバーをモバイルでは上部に配置 */
    .chat-panel {
        top: 70px;
        left: 0;
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .map-fullscreen {
        left: 0;
        top: calc(70px + 40vh);
        width: 100%;
        height: calc(100% - 70px - 40vh - 30px);
    }

    .attribution {
        left: 0;
    }

    .debug-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        max-height: 400px;
        bottom: 50px;
    }

    .transparency-btn {
        top: auto;
        bottom: 70px;
        right: 20px;
        font-size: 12px;
        padding: 8px 12px;
    }

    .chart-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }

    .stats-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}

/* ====================================
   LLMローディングオーバーレイ
   ==================================== */
.llm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.llm-loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    padding: 30px;
    max-width: 320px;
}

.loading-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #357abd);
    width: 0%;
    transition: width 0.3s ease;
}

.loading-status {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.loading-detail {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    margin-bottom: 12px;
}

.loading-note {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 12px;
}

.loading-model-name {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    margin: 8px 0;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.loading-device-info {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    border: 1px dashed var(--border);
}

.loading-device-info strong {
    color: var(--text-primary);
}

/* ====================================
   市町村情報ポップアップ
   ==================================== */
/* ズームアニメーション中のポップアップ非表示 */
.leaflet-popup-pane.popup-pane-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0s !important;
}

/* 市町村ポップアップ - ライトグレー系Glassmorphism */
.custom-municipality-popup .leaflet-popup-content-wrapper {
    background: rgba(245, 245, 250, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    padding: 0;
    min-width: 280px;
}

.custom-municipality-popup .leaflet-popup-content {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    color: #333333;
}

.custom-municipality-popup .leaflet-popup-tip {
    background: rgba(245, 245, 250, 0.88);
    border: none;
}

.popup-content {
    padding: 15px;
}

.popup-content h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #222222;
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
}

.popup-stats {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.popup-stats tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.popup-stats tr:last-child {
    border-bottom: none;
}

.popup-stats tr.highlight {
    background: rgba(0, 0, 0, 0.05);
}

.popup-stats td {
    padding: 10px 8px;
    font-size: 13px;
}

.popup-stats .label {
    color: rgba(0, 0, 0, 0.6);
    font-weight: 600;
    width: 45%;
}

.popup-stats .value {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #222222;
    text-align: right;
    letter-spacing: 0.3px;
}

.popup-stats .unit {
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.5);
    margin-left: 4px;
}

/* ====================================
   チャットメッセージメタデータ（経路・処理時間・クエリタイプ）
   ==================================== */
.message-metadata {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 11px;
    align-items: center;
}

.route-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sql {
    background: rgba(74, 144, 226, 0.15);
    color: #2a5fa8;
    border: 1px solid rgba(74, 144, 226, 0.4);
}

.badge-llm {
    background: rgba(255, 99, 132, 0.15);
    color: #c7254e;
    border: 1px solid rgba(255, 99, 132, 0.4);
}

.query-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 10px;
    background: rgba(153, 102, 255, 0.15);
    color: #6b46c1;
    border: 1px solid rgba(153, 102, 255, 0.4);
}

.latency-info {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ====================================
   レイヤー切り替えパネル
   ==================================== */
.layer-panel {
    bottom: 60px;
    left: 400px;
    width: 200px;
    background: var(--glass-bg-light);
}

.layer-panel .panel-header {
    padding: 10px 15px;
}

.layer-panel .panel-header h3 {
    font-size: 14px;
}

.layer-panel .panel-body {
    padding: 12px 15px;
}

.layer-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.layer-option:hover {
    background: rgba(255, 255, 255, 0.45);
    border-color: var(--glass-border);
}

.layer-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4a90e2;
}

.layer-icon {
    font-size: 14px;
}

.layer-legend {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border-subtle);
}

.layer-legend h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.legend-line {
    width: 24px;
    height: 3px;
    border-radius: 2px;
}

/* ====================================
   広域連携レイヤー
   ==================================== */
.cooperation-line-active {
    stroke-linecap: round;
}

.cooperation-line-planned {
    stroke-linecap: round;
    animation: dash-animation 1s linear infinite;
}

@keyframes dash-animation {
    to {
        stroke-dashoffset: -20;
    }
}

.facility-status-marker {
    z-index: 600 !important;
}

/* ====================================
   施設マーカー
   ==================================== */
.facility-marker {
    background: transparent !important;
    border: none !important;
}

.facility-marker-inner {
    transition: transform 0.2s ease;
}

.facility-marker:hover .facility-marker-inner {
    transform: scale(1.2);
}

.facility-tooltip {
    background: var(--glass-bg-light) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--glass-shadow) !important;
}

.facility-tooltip::before {
    border-top-color: var(--glass-border) !important;
}

/* 施設ポップアップ - ライトグレー系Glassmorphism */
.facility-popup .leaflet-popup-content-wrapper {
    background: rgba(245, 245, 250, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    padding: 0;
}

.facility-popup .leaflet-popup-content {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    color: #333333;
}

.facility-popup .leaflet-popup-tip {
    background: rgba(245, 245, 250, 0.88);
    border: none;
}

.facility-popup-content {
    padding: 16px;
}

.facility-popup-content h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #222222;
    margin: 0 0 4px 0;
    letter-spacing: 0.3px;
}

.facility-municipality {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.facility-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.facility-stat {
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.facility-stat .stat-label {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.facility-stat .stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #222222;
}

.facility-stat .stat-value.status-high {
    color: #16a34a;
}

.facility-stat .stat-value.status-medium {
    color: #ca8a04;
}

.facility-stat .stat-value.status-low {
    color: #dc2626;
}

.status-badge {
    display: inline-block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: currentColor;
    color: white !important;
}

.facility-projection {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.facility-projection h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.projection-values {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ====================================
   散布図パネル
   ==================================== */
.scatter-panel {
    top: 110px;
    right: 240px;
    width: 420px;
    background: var(--glass-bg-light);
}

.scatter-container {
    height: 280px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--glass-radius-sm);
    border: 1px solid var(--glass-border-subtle);
}

.scatter-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 11px;
}

.scatter-legend .legend-item {
    margin-bottom: 0;
}

/* レスポンシブ: レイヤーパネル */
@media (max-width: 1024px) {
    .layer-panel {
        left: 20px;
        bottom: 60px;
    }

    .scatter-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .layer-panel {
        width: 160px;
        left: 20px;
        bottom: 60px;
    }

    .layer-option {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* ================================
   シミュレーションパネル
   ================================ */
.simulation-panel {
    position: fixed;
    left: 400px;
    top: 100px;
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
}

.simulation-panel .panel-header {
    background: rgba(99, 102, 241, 0.2);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

.simulation-panel .panel-header h3 {
    font-size: 14px;
}

.simulation-panel .panel-body {
    padding: 12px;
}

/* 選択モードボタン */
.simulation-mode {
    margin-bottom: 12px;
}

.mode-btn {
    width: 100%;
    padding: 10px 15px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--glass-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.mode-btn.active {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
    color: #4f46e5;
}

.mode-icon {
    font-size: 16px;
}

/* 選択セクション */
.selection-section {
    margin-bottom: 12px;
}

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.selection-header strong {
    color: #6366f1;
    font-size: 14px;
}

.clear-btn {
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    font-size: 10px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.selection-list {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--glass-radius-sm);
    background: rgba(255, 255, 255, 0.2);
}

.selection-list .empty-message {
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 11px;
}

.selection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--glass-border-subtle);
    font-size: 12px;
}

.selection-item:last-child {
    border-bottom: none;
}

.selection-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.selection-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    color: var(--text-secondary);
}

.remove-btn {
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: 50%;
    color: #ef4444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* 選択サマリー */
.selection-summary {
    padding: 10px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--glass-radius-sm);
    margin-bottom: 12px;
}

.selection-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 11px;
}

.selection-summary .summary-label {
    color: var(--text-secondary);
}

.selection-summary .summary-value {
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    color: #6366f1;
}

/* シナリオセクション */
.scenario-section {
    margin-bottom: 12px;
}

.scenario-section h4 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.scenario-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scenario-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.scenario-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(99, 102, 241, 0.4);
}

.scenario-icon {
    font-size: 18px;
}

.scenario-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* シミュレーション結果 */
.simulation-result {
    border-top: 1px solid var(--glass-border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-result-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.close-result-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Before/After比較グリッド */
.comparison-grid {
    display: grid;
    gap: 8px;
}

.comparison-item {
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--glass-radius-sm);
}

.comparison-item.highlight {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.comparison-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.comparison-values {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.comparison-values .before {
    color: #ef4444;
    font-weight: 600;
}

.comparison-values .arrow {
    color: var(--text-secondary);
}

.comparison-values .after {
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-values .after.improved {
    color: #22c55e;
}

.comparison-change {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.comparison-change.positive {
    color: #22c55e;
}

.comparison-value-large {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #22c55e;
}

/* 比較グラフコンテナ */
.result-chart-container {
    height: 150px;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--glass-radius-sm);
    padding: 10px;
}

/* レスポンシブ: シミュレーションパネル */
@media (max-width: 1024px) {
    .simulation-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .simulation-panel {
        display: none;
    }
}

/* ====================================
   LLMモデル選択UI
   ==================================== */
.model-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#llmModelSelect {
    min-width: 180px;
}

.model-info-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.model-info-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(74, 144, 226, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* モデル比較ツールチップ */
.model-comparison-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-shadow-intense);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 16px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.model-comparison-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.model-comparison-tooltip h4 {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.model-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.model-comparison-table th,
.model-comparison-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border-subtle);
}

.model-comparison-table th {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-comparison-table td {
    color: var(--text-primary);
}

.model-comparison-table tr.highlight {
    background: rgba(74, 144, 226, 0.08);
}

.model-comparison-table tr.highlight td {
    font-weight: 600;
}

.tooltip-note {
    font-size: 10px;
    color: var(--text-secondary);
    margin: 12px 0 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border-subtle);
    font-style: italic;
}

/* ====================================
   シミュレーション・範囲外バッジ
   ==================================== */
.badge-simulation {
    background: rgba(99, 102, 241, 0.15);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge-out-of-scope {
    background: rgba(156, 163, 175, 0.15);
    color: #6b7280;
    border: 1px solid rgba(156, 163, 175, 0.4);
}

.badge-system {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

/* ====================================
   クイック質問ボタンのタイプ別スタイル
   ==================================== */
.question-btn[data-type="simulation"] {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4f46e5;
}

.question-btn[data-type="simulation"]:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.question-btn[data-type="compare"] {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.3);
    color: #b45309;
}

.question-btn[data-type="compare"]:hover {
    background: rgba(234, 179, 8, 0.25);
    border-color: rgba(234, 179, 8, 0.5);
}

/* ====================================
   レスポンシブ: モデル選択UI
   ==================================== */
@media (max-width: 768px) {
    .model-selector-wrapper {
        flex-direction: column;
        gap: 5px;
    }

    #llmModelSelect {
        min-width: 140px;
        font-size: 12px;
    }

    .model-comparison-tooltip {
        width: 280px;
        right: -50px;
    }
}

/* ====================================
   思考プロセス表示 (Thinking Indicator)
   ==================================== */
.thinking-message {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.08), rgba(102, 126, 234, 0.05));
    border-left: 3px solid rgba(74, 144, 226, 0.6);
    animation: thinkingPulse 2s ease-in-out infinite;
    padding: 8px 10px;
    margin-bottom: 8px;
}

@keyframes thinkingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.thinking-container {
    padding: 4px 0;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.thinking-icon {
    font-size: 18px;
    animation: thinkingBrain 1.5s ease-in-out infinite;
}

@keyframes thinkingBrain {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.thinking-title {
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 13px;
    color: #4a90e2;
    letter-spacing: 0.5px;
}

.thinking-steps {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-left: 6px;
    padding-left: 10px;
    border-left: 2px solid rgba(74, 144, 226, 0.2);
    max-height: 70px;  /* 約4行分 */
    overflow-y: auto;
}

.thinking-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
    opacity: 0.7;
    transition: all 0.3s ease;
    line-height: 1.3;
}

.thinking-step.active {
    opacity: 1;
    color: #333;
    animation: stepAppear 0.3s ease-out;
}

.thinking-step.completed {
    opacity: 0.5;
}

.thinking-step.completed .step-icon {
    color: #27ae60;
}

@keyframes stepAppear {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.step-text {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 500;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    margin-left: 28px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background: rgba(74, 144, 226, 0.6);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ==========================================
   シミュレーション選択UI
   ========================================== */
.simulation-selector {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    margin: 8px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.simulation-selector-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15), rgba(74, 144, 226, 0.05));
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
}

.simulation-selector-icon {
    font-size: 16px;
}

.simulation-selector-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    flex: 1;
}

.simulation-selector-close {
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.simulation-selector-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.simulation-selector-body {
    padding: 12px;
}

.simulation-presets {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.simulation-preset-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.simulation-preset-option:hover {
    background: rgba(74, 144, 226, 0.08);
    border-color: rgba(74, 144, 226, 0.2);
}

.simulation-preset-option input[type="radio"] {
    margin-top: 2px;
    accent-color: #4a90e2;
    transform: scale(1.1);
}

.simulation-preset-option input[type="radio"]:checked + .preset-content {
    color: #4a90e2;
}

.simulation-preset-option:has(input:checked) {
    background: rgba(74, 144, 226, 0.12);
    border-color: rgba(74, 144, 226, 0.3);
}

.preset-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.preset-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.preset-desc {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.simulation-target {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    font-size: 12px;
}

.target-label {
    color: #666;
    white-space: nowrap;
}

.target-municipalities {
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simulation-selector-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.sim-run-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sim-run-btn:hover {
    background: linear-gradient(135deg, #357abd, #2868a0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.sim-run-btn:active {
    transform: translateY(0);
}
