/* 地図の全画面表示 */
body { margin: 0; padding: 0; font-family: 'Helvetica Neue', Arial, sans-serif; }
#map { height: 100vh; width: 100%; }

/* --- ピンのデザイン（赤丸に白文字の！） --- */
.custom-pin-icon {
    background-color: #e63232;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    border: 2px solid white;
}

/* --- ピン直下のラベル --- */
.leaflet-tooltip-bottom {
    background-color: rgba(255, 255, 255, 0.92);
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    color: #000;
    font-weight: bold;
    font-size: 12px;
    padding: 2px 6px;
    margin-top: 20px;
}
.leaflet-tooltip-bottom::before { display: none; }

/* --- クラスタの設定 --- */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background-color: rgba(230, 50, 50, 0.35);
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: rgba(230, 50, 50, 0.85);
    color: white;
    font-weight: bold;
    font-size: 20px;
    line-height: 30px;
}

/* =========================================
   コントロールパネル（グラスモーフィズム）
   ========================================= */
#control-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    width: 260px;
    background: rgba(10, 10, 30, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 14px 14px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    color: #fff;
    touch-action: pan-x pan-y; /* パネル上のピンチ操作を無効化 */
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 10px 0;
}

/* 検索入力ラップ */
#search-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    padding: 0 10px;
    gap: 6px;
    transition: border-color 0.2s;
}
#search-input-wrap:focus-within {
    border-color: rgba(255, 100, 100, 0.7);
    background: rgba(255, 255, 255, 0.18);
}
.search-icon { font-size: 14px; opacity: 0.75; }

#mountain-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    padding: 8px 0;
}
#mountain-search::placeholder { color: rgba(255,255,255,0.45); }

/* 検索候補リスト */
#search-suggestions {
    display: none;
    flex-direction: column;
    background: rgba(15, 15, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    max-height: 180px;
    overflow-y: auto;
}
#search-suggestions.visible { display: flex; }
.suggestion-item {
    padding: 8px 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.highlighted {
    background: rgba(230, 50, 50, 0.45);
    color: #fff;
}
.suggestion-item .match-highlight { color: #ff8080; font-weight: bold; }

/* ドロップダウン */
#mountain-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.6)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s, background-color 0.2s;
}
#mountain-select:focus {
    border-color: rgba(255, 100, 100, 0.7);
    background-color: rgba(255, 255, 255, 0.18);
}
#mountain-select option {
    background-color: #1a1a2e;
    color: #fff;
}

/* 年代フィルターラベル */
.filter-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
}

/* 年代ボタン群 */
#decade-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.decade-btn {
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.1s;
    white-space: nowrap;
}
.decade-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.45);
}
.decade-btn.active {
    background: #e63232;
    border-color: #e63232;
    color: #fff;
    box-shadow: 0 0 8px rgba(230, 50, 50, 0.55);
}
.decade-btn:active { transform: scale(0.95); }

/* 統計バッジ */
#stats-badge {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    text-align: right;
    letter-spacing: 0.03em;
}

/* =========================================
   スマホ用トグルボタン（デスクトップでは非表示）
   ========================================= */
#panel-toggle-btn {
    display: none;
}

/* =========================================
   ホームボタン
   ========================================= */
#home-btn {
    position: fixed;
    top: 90px;
    left: 16px;
    z-index: 1000;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(10, 10, 30, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.03em;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
#home-btn:hover {
    background: rgba(30, 30, 60, 0.75);
    border-color: rgba(255, 255, 255, 0.35);
}
#home-btn:active { transform: scale(0.97); }

/* =========================================
   モーダルウィンドウ
   ========================================= */
#modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
#modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

#modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    text-align: center;
}

#modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}
#modal-close-btn:hover { color: #000; }

#m-title {
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: 17px;
    font-weight: bold;
    color: #222;
    line-height: 1.45;
}
#m-date {
    margin: -8px 0 14px;
    font-size: 12px;
    color: #888;
}
.thumb-container { margin-bottom: 18px; }
#m-thumb {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
#m-btn {
    display: block;
    width: 100%;
    padding: 12px 0;
    background-color: #e63232;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 7px;
    transition: background-color 0.2s;
}
#m-btn:hover { background-color: #c02222; }

/* =========================================
   スマホ対応（640px以下）
   ========================================= */
@media (max-width: 640px) {

    /* トグルボタン表示 */
    #panel-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 16px;
        right: 16px;
        z-index: 1001;
        width: 46px;
        height: 46px;
        font-size: 22px;
        background: rgba(10, 10, 30, 0.75);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 12px;
        color: #fff;
        cursor: pointer;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
        touch-action: manipulation; /* ダブルタップズームを無効化 */
    }

    /* コントロールパネル：スマホではデフォルト非表示 */
    #control-panel {
        top: 72px;       /* トグルボタンの直下 */
        right: 16px;
        left: 16px;
        width: auto;     /* 横幅いっぱいに広げる */
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity 0.22s ease, transform 0.22s ease;
    }

    /* 開いている状態 */
    #control-panel.panel-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    /* ホームボタンをスマホでは左下に移動（ズームボタンと重ならない） */
    #home-btn {
        top: auto;
        bottom: 30px;
        left: 16px;
        font-size: 12px;
        padding: 9px 13px;
    }

    /* 年代ボタンを少し小さく */
    .decade-btn {
        font-size: 10px;
        padding: 4px 7px;
    }

    /* iOSの自動ズームを防ぐ（フォント16px未満だとタップ時にズームされる） */
    #mountain-search,
    #mountain-select {
        font-size: 16px;
    }
}
