body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

#map {
    width: 100%;
    flex-grow: 1;
    /* ヘッダーとフッター以外の「残りの空間すべて」を地図にする */
    z-index: 1;
}

/* ヘッダーのデザイン */
.site-header {
    background-color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    /* タイトルを左、リンクを右に分ける */
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    /* 軽い影をつけて地図と区別する */
    z-index: 10;
    /* 地図より前面に出す */
}

.site-header h1 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.dev-link {
    color: #0f1419;
    /* Xのブランドカラーに近い黒 */
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid #ccc;
    padding: 4px 12px;
    border-radius: 20px;
    transition: background 0.2s;
}

.dev-link:hover {
    background-color: #eee;
}

/* フッターのデザイン */
.site-footer {
    background-color: #333;
    color: #ccc;
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    z-index: 10;
}

.site-footer p {
    margin: 0;
}

/* Leaflet標準のコンテンツエリアのマージンをリセット */
.leaflet-popup-content {
    margin: 0 !important;
    /* 標準の13px 19pxなどの余白をゼロにする */
    width: 320px !important;
    /* コンテナと同じ幅に固定 */
}

/* ポップアップの土台自体のパディングも調整 */
.leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.popup-container {
    width: 320px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    /* 中央寄せ */
}

.spot-title {
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    margin-bottom: 8px;
    color: #333;
    border-bottom: 2px solid #ccc;
    padding-bottom: 4px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    margin: 0;
}

.carousel {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: 10px;
    align-items: flex-start;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    box-sizing: border-box;
    padding: 0 5px;
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-btn {
    position: absolute;
    top: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.nav-left {
    left: 0px;
}

.nav-right {
    right: 0px;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #e60012;
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 10;
    margin-top: 8px;
    margin-right: 5px;
}

.leaflet-popup-close-button {
    display: none
}

/* --- 読み込み中アニメーション（インジケーター） --- */
.loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* --- 【追加】地図全体（ピン読み込み中）のロード中インジケーター --- */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7); /* 地図を少し薄く隠す */
    z-index: 500; /* Leafletのコントロール類(z-index: 1000)より下、タイル(z-index: 200)より上 */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* インジケーターと文字を縦に並べる */
    opacity: 1;
    transition: opacity 0.5s ease; /* 消えるときにフワッとさせる */
}

.map-loading-indicator {
    width: 60px; /* ポップアップ用より大きく */
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite; /* 共通のspinアニメーションを使用 */
    margin-bottom: 15px; /* 下の文字との余白 */
}

.map-loading-text {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 【修正】プレースホルダーを絶対配置にして、透明なカルーセルを上から覆い隠すようにする */
.loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #eee;
    border-radius: 6px;
    z-index: 15;
    /* カルーセルより上に配置 */
    overflow: hidden;
}

.loading-placeholder::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: placeholder-loading 1.5s infinite;
}

@keyframes placeholder-loading {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}