:root {
    --primary: #007AFF;
    --primary-hover: #0056b3;
    --bg: #f5f5f7;
    --panel-bg: rgba(255, 255, 255, 0.98);
    --radius: 20px;
    --text-main: #1d1d1f;
}

body, html { margin: 0; padding: 0; height: 100%; font-family: -apple-system, sans-serif; overflow: hidden; }

/* --- Leaflet標準の閉じるボタンを上書き --- */
.leaflet-popup-close-button {
    top: 15px !important;
    right: 15px !important;
    width: 30px !important;
    height: 30px !important;
    background: #f2f2f7 !important;
    color: #8e8e93 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: none !important;
    font-size: 16px !important;
    padding-top: 2px !important;
    padding: 5px;
}

.leaflet-popup {
    margin-bottom: 40px !important;
}

/* --- サイドバー --- */
#sidebar {
    position: fixed; top: 20px; left: 20px; width: 320px; max-height: 85vh;
    background: var(--panel-bg); backdrop-filter: blur(15px);
    border-radius: var(--radius); z-index: 2000; box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    display: flex; flex-direction: column; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
#sidebar.closed { transform: translateX(-360px); opacity: 0; }

.sidebar-header { padding: 24px 20px 15px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.sidebar-header strong { font-size: 1.2rem; color: var(--text-main); }

.close-sidebar { width: 36px; height: 36px; border-radius: 50%; border: none; background: #f2f2f7; color: #8e8e93; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 18px; }
.close-sidebar:hover { background: #e5e5ea; color: var(--text-main); }

.spot-list { overflow-y: auto; padding: 10px; flex: 1; }
.spot-item { padding: 15px; margin-bottom: 8px; border-radius: 14px; cursor: pointer; transition: 0.2s; background: transparent; }
.spot-item:hover { background: rgba(0,122,255,0.08); color: var(--primary); }

.menu-toggle { position: fixed; top: 20px; left: 20px; z-index: 1900; padding: 12px 20px; background: var(--primary); color: white; border: none; border-radius: 12px; cursor: pointer; font-weight: 600; box-shadow: 0 4px 12px rgba(0,122,255,0.3); transition: 0.2s; }
.menu-toggle:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* --- 地図ピン（サムネイル）最終調整版 --- */
.custom-pin {
    filter: drop-shadow(0 2px 5px rgba(2,2,0,0.5));
}

.pin-bubble {
    display: inline-flex;
    background: white;
    border-radius: 6px;
    padding: 8px;
    position: relative;
    transform: translate(-50%, calc(-100% - 8px));
}

.pin-bubble img {
    display: block;
    height: 100px;
    width: auto;
    max-width: 50px;
    max-height: 40px;
    border-radius: 3px;
}

/* 吹き出しのトゲ：本体と一体化させる */
.pin-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 8px solid white;
}

/* --- ポップアップ・比較画面 --- */
.leaflet-popup-content {
    width: 90vw !important;
    max-width: 800px !important;
    margin: 15px;
}
.view-port { width: 100%; aspect-ratio: 16 / 9; position: relative; background: #000; border-radius: 12px; overflow: hidden; }

.img-base {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background-size: contain; background-repeat: no-repeat; background-position: center;
    background-color: #000;
}

.img-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background-size: contain; background-repeat: no-repeat; background-position: center;
    z-index: 2;
    border-right: 2px solid white;
    background-color: #000;
}

.range-slider { position: absolute; top:0; left:0; width: 100%; height: 100%; -webkit-appearance: none; background: transparent; z-index: 10; cursor: ew-resize; margin:0; }

.mode-side { display: flex; height: 100%; background: #000; gap: 4px; }
.mode-side .side-img-box {
    position: relative;
    flex: 1;
    background-size: contain !important;
    background-repeat: no-repeat;
    background-position: center;
}

.date-tag {
  position: absolute;
  top: 15px; background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  /* margin-top: 0px; */
  font-size: 13px;
  z-index: 5;
  pointer-events: none;
}
.tag-left { left: 15px; }
.tag-right { right: 15px; }

.nav-group { display: flex; gap: 10px; margin-top: 15px; }
.btn { flex: 1; padding: 12px; border: none; border-radius: 12px; background: #eee; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-active { background: var(--primary); color: white; }

.marker-hidden { opacity: 0; transition: opacity 0.3s; pointer-events: none; }

@media (max-width: 600px) {
    #sidebar { width: calc(100% - 40px); left: 20px; top: 20px; }
}

/* --- ヘッダー・ロゴ --- */
.main-header { position: fixed; top: 15px; right: 15px; z-index: 1000; pointer-events: none; }
.header-logo { height: 40px; pointer-events: auto; }
.home-back-btn {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 1000; background: white; padding: 10px 20px; border-radius: 30px;
    text-decoration: none; color: #333; font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.home-back-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.home-icon {
    font-size: 1.2rem;
}

/* サイドバー内のヘルプ項目 */
.help-item {
    margin: 10px;
    padding: 12px;
    background: #fff;
    border: 2px dashed var(--primary);
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    transition: 0.2s;
}
.help-item:hover {
    background: #f0f7ff;
}

/* モーダル（ヘルプ画面）のスタイル */
.modal-overlay {
    display: none; /* 初期状態は非表示 */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: #eee; border: none;
    width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer;
}

.help-body ul {
    padding-left: 20px;
    line-height: 1.8;
}

/* --- スマホ向けの表示最適化 --- */
@media (max-width: 480px) {
    .leaflet-popup-content {
        width: 90vw !important;
        margin: 8px !important;
    }

    /* 比較モード切り替えボタンのグループ */
    .nav-group {
        display: flex;
        gap: 2px;
        margin-bottom: 6px !important;
    }
    .btn {
        flex: 1;
        padding: 6px 2px;
        white-space: nowrap;
        letter-spacing: -0.5px;
    }
    .view-port {
        aspect-ratio: auto;
        height: 180px;
    }

  .main-header {
      position: fixed; top: 20px; right: 20px; z-index: 1000;
  }
  .header-logo { height: 40px; pointer-events: auto; }

    .home-back-btn {
        bottom: 20px;
        padding: 10px 18px;
        font-size: 14px;
    }
}
