/* 全体設定 */
body, html, #map {
    margin: 0; padding: 0; height: 100%; width: 100%;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
}

/* 📱 画面上の固定ボタン群（左上・右上） */
#menu-btn, #location-btn, #reload-btn {
    position: fixed;
    background: white; border: 2px solid rgba(0,0,0,0.2); border-radius: 8px;
    width: 45px; height: 45px; font-weight: bold; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; font-size: 24px;
}
#menu-btn { 
    top: 15px; left: 15px; 
    z-index: 10000;
}
#location-btn { 
    top: 15px; right: 15px; 
    z-index: 900;
}
#reload-btn { 
    top: 70px; right: 15px; 
    z-index: 900;
    font-size: 22px; 
}

/* 🚪 スライドメニュー */
.leaflet-control-layers {
    position: fixed !important; top: 0 !important; left: -320px !important; 
    width: 280px !important; margin: 0 !important;
    border-radius: 0 !important; border: none !important;
    box-shadow: 4px 0 15px rgba(0,0,0,0.3) !important; background: rgba(255, 255, 255, 0.95) !important;
    transition: left 0.3s ease-in-out !important;
    z-index: 1000 !important;
    /* ▼ 修正ポイント①：最新スマホのバーに隠れない高さ設定 */
    height: 100vh !important; 
    height: 100dvh !important; 
    /* ▼ 修正ポイント②：一番下までスクロールできるよう、下の余白（40px→120px）をガッツリ増やしたぜ！ */
    padding: 75px 20px 120px 20px !important; 
    box-sizing: border-box !important; 
    overflow-y: auto !important;
}
body.menu-open .leaflet-control-layers { left: 0 !important; }

/* 🚨 Leafletの「常にスクロールバーを出す」お節介仕様を無効化！ */
.leaflet-control-layers-scrollbar {
    overflow-y: auto !important;
    padding-right: 10px !important;
}

/* 🚨 PCで見てもスマホのような細くて美しいスクロールバーにする魔法 */
.leaflet-control-layers::-webkit-scrollbar,
.leaflet-control-layers-scrollbar::-webkit-scrollbar {
    width: 5px;
}
.leaflet-control-layers::-webkit-scrollbar-track,
.leaflet-control-layers-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.leaflet-control-layers::-webkit-scrollbar-thumb,
.leaflet-control-layers-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

/* 📡 スキャンボタン (画面下部) */
#scan-btn {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 900;
    padding: 12px 24px; border: none; border-radius: 30px;
    font-size: 15px; font-weight: bold; color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4); transition: all 0.3s ease; white-space: nowrap;
}
#scan-btn:not(.disabled) { background-color: #007BFF; cursor: pointer; }
#scan-btn.disabled { background-color: #888888; cursor: not-allowed; opacity: 0.8; }

/* 📜 右下のフローティングボタン */
.floating-btn {
    position: fixed; right: 15px; 
    z-index: 900;
    background: white; border: 2px solid rgba(0,0,0,0.2); border-radius: 8px;
    width: 45px; height: 45px; font-weight: bold; cursor: pointer; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.3); font-size: 22px; 
    display: flex; justify-content: center; align-items: center;
}
#help-btn { bottom: 75px; } 
#license-btn { bottom: 20px; }

/* チェックボックス水平揃え */
.leaflet-control-layers-overlays label { display: flex !important; align-items: center !important; margin-bottom: 8px !important; font-size: 15px; cursor: pointer; }
.leaflet-control-layers-overlays input[type="checkbox"] { margin: 0 12px 0 0 !important; flex-shrink: 0 !important; width: 16px; height: 16px; cursor: pointer; }
.leaflet-control-layers-overlays span { display: flex !important; align-items: center !important; }
.leaflet-control-layers-toggle { display: none !important; }

/* ⏳ ローディング設定 */
#loading-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 100000; transition: opacity 0.8s ease; }
#loading-logo { max-width: 80%; max-height: 35vh; object-fit: contain; margin-bottom: 20px; border: none !important; outline: none; }
.warning-text { color: #444; font-size: 0.8rem; line-height: 1.6; text-align: center; padding: 0 10px; margin-bottom: 20px; }
.leaflet-left .leaflet-control { margin-left: 0; }
