body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 全体を跟くメインコンテナ */
#main-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 上半分：VRパネル（初期50%） */
#pano-wrapper {
    flex: 1 1 50%;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: #000;
}

/* Pano2VR iframe */
#pano-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    display: block;
}

/* ドラッグ分割バー */
#divider {
    width: 100%;
    height: 2px;
    flex-shrink: 0;
    background: #000;
    /* 見える境界線は2px、ドラッグ領域は疑似要素で上下に広げる */
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    position: relative;
    touch-action: none;
    user-select: none;
}

/* パネルに重ねる透明なドラッグ領域 */
#divider::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 12px;
}

/* 中央の細い境界線 */
#divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 2px;
    background: rgb(0 0 0);
    transition: background 0.2s;
}

/* hover / active エフェクト */
#divider:hover::before,
#divider:active::before {
    background: rgb(0, 0, 0);
}

#divider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 20px;
    background: #2a2a30;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#divider-handle .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

/* 下半分：マップパネル（初期50%） */
.map-wrapper {
    flex: 1 1 50%;
    position: relative;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
}

#map {
    width: 100%;
    height: 100%;
}

#map-bottom-ui {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    pointer-events: none;
    transition: left 0.3s ease, transform 0.3s ease;
}

/* 共通非表示ユーティリティ */
.hidden {
    display: none !important;
}

/* --- カスタムマーカーとレーダーのスタイル --- */
.current-location-marker {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-beam {
    position: absolute;
    width: 120px;
    height: 120px;
    /* 輪郭をシャープにし、先端までぼやけない均一な扇形 */
    background: conic-gradient(from 330deg, rgba(255, 59, 48, 0.2) 0deg, rgba(255, 59, 48, 0.2) 60deg, transparent 60deg);
    border-radius: 50%;
    transform-origin: center;
    transition: transform 0.1s ease-out;
    /* 滑らかな回転 */
}

.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: #ff3b30;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

/* --- カテゴリ別カスタムマーカーのスタイル --- */
/* マーカーごと最前面に引き上げることで、吹き出しが他のピンの裏に隠れるのを防ぐ */
.category-marker.destination-active {
    z-index: 9999 !important;
}

.category-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 40px;
    cursor: pointer;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
    /* ドラッグ・ズーム時のマーカー追従遅延を防ぐため、親コンテナの transition は設定しない */
}

/* 実HTML要素による吹き出し */
.marker-tooltip {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(30, 30, 34, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    z-index: 100;
}

.marker-spot-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.marker-route-distance {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 600;
}

/* 目的地が選択されている時に吹き出しを表示 */
.category-marker.destination-active .marker-tooltip {
    opacity: 1;
    pointer-events: auto;
    /* リンクをクリックできるようにする */
}

/* サイトリンクボタン */
.marker-site-link {
    color: #93c5fd;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.marker-site-link:hover {
    background: #3b82f6;
    color: white;
}

.category-marker svg,
.category-marker .marker-icon {
    transition: transform 0.2s ease;
}

.category-marker.destination-active svg {
    transform: scale(1.15);
    transform-origin: bottom center;
}

.category-marker.destination-active .marker-icon {
    transform: translateX(-50%) scale(1.15);
    transform-origin: center;
}

/* ホバー可能なデバイス(PC等)のみ適用。iOS Safariでの2回タップ防止 */
@media (hover: hover) and (pointer: fine) {
    .category-marker:hover {
        z-index: 9999 !important;
    }
    .category-marker:hover .marker-tooltip {
        opacity: 1;
        pointer-events: auto;
    }
    .category-marker:hover svg {
        transform: scale(1.15);
        transform-origin: bottom center;
    }
    .category-marker:hover .marker-icon {
        transform: translateX(-50%) scale(1.15);
        transform-origin: center;
    }
}

.category-marker svg {
    width: 100%;
    height: 100%;
    display: block;
}

.category-marker .marker-icon {
    position: absolute;
    top: 6px;
    /* ピンの頭部円形の真ん中に配置 */
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 16px;
    pointer-events: none;
}

/* ユーザー指定パステルカラーをSVGの塗りに適用 */
.category-marker.eats path {
    fill: rgb(253, 201, 133);
}

.category-marker.shop path {
    fill: rgb(161, 196, 253);
}

.category-marker.sights path {
    fill: rgb(166, 230, 18);
}

.category-marker.sights .marker-icon {
    color: #333333;
    /* 明るい緑で見えにくいため文字色をダークに */
}

.category-marker.venue path {
    fill: rgb(169, 86, 232);
}

.category-marker.panorama path {
    fill: rgb(41, 143, 202);
}

/* エディタへのリンクボタン */
#btn-open-editor {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: #1e1e22;
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

#btn-open-editor:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* --- 自作GPS現在地用スタイル --- */
.gps-user-marker {
    width: 18px;
    height: 18px;
    background-color: #3b82f6;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
    animation: gps-pulse 2s infinite;
}

@keyframes gps-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* --- カテゴリフィルターバー --- */
#category-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(10, 10, 16, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 6px 8px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    pointer-events: auto;
    /* ボタンをクリックできるようにする */
    max-width: 98vw;
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* GPS ON/OFFボタン */
#gps-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    border-radius: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.20);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.80);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px 8px;
}

#gps-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

#gps-toggle-btn:active {
    transform: scale(0.88);
}

#gps-toggle-btn .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
}

#gps-toggle-btn.active {
    background: rgba(59, 130, 246, 0.20);
    border-color: #3b82f6;
    color: #93c5fd;
}

#gps-toggle-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}


.cat-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    letter-spacing: 0.4px;
    outline: none;
}

.cat-filter-btn .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.cat-filter-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.18);
}

.cat-filter-btn:active .material-symbols-outlined {
    transform: scale(0.85);
}

/* カテゴリ別アクティブスタイル（マーカー色に準拠） */
.cat-filter-btn.active[data-category="eats"] {
    background: rgba(253, 201, 133, 0.16);
    border-color: rgba(253, 201, 133, 0.55);
    color: #fdc985;
    box-shadow: 0 0 10px rgba(253, 201, 133, 0.15);
}

.cat-filter-btn.active[data-category="shop"] {
    background: rgba(161, 196, 253, 0.16);
    border-color: rgba(161, 196, 253, 0.55);
    color: #a1c4fd;
    box-shadow: 0 0 10px rgba(161, 196, 253, 0.15);
}

.cat-filter-btn.active[data-category="sights"] {
    background: rgba(166, 230, 18, 0.14);
    border-color: rgba(166, 230, 18, 0.50);
    color: #b0e832;
    box-shadow: 0 0 10px rgba(166, 230, 18, 0.12);
}

.cat-filter-btn.active[data-category="venue"] {
    background: rgba(169, 86, 232, 0.16);
    border-color: rgba(169, 86, 232, 0.55);
    color: #c084fc;
    box-shadow: 0 0 10px rgba(169, 86, 232, 0.15);
}

.cat-filter-btn.active[data-category="panorama"] {
    background: rgba(41, 143, 202, 0.16);
    border-color: rgba(41, 143, 202, 0.55);
    color: #60b4e8;
    box-shadow: 0 0 10px rgba(41, 143, 202, 0.15);
}

/* 吹き出し内 WebVR表示ボタンのスタイル */
.marker-vr-link {
    background: rgba(41, 143, 202, 0.25);
    border: 1px solid rgba(41, 143, 202, 0.6);
    color: #8ed2ff;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.marker-vr-link:hover {
    background: rgb(41, 143, 202);
    border-color: rgb(41, 143, 202);
    color: white;
    box-shadow: 0 3px 8px rgba(41, 143, 202, 0.4);
    transform: translateY(-0.5px);
}

.marker-vr-link:active {
    transform: translateY(0.5px);
}

/* --- 画面上部 スポット詳細情報パネルのスタイル --- */
.spot-info-panel {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    width: 90%;
    max-width: 550px;
    background: rgba(15, 23, 42, 0.85);
    /* 深いダークスレート調 */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    /* 地図コントロールやアクティブなマーカー(9999)より前面に */
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    /* 非表示時はクリックを透過させる */
}

.spot-info-panel.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
    /* 表示時のみクリックを可能にする */
}

.spot-info-panel .panel-content {
    display: flex;
    flex-direction: row;
    position: relative;
    padding: 16px;
    gap: 16px;
}

@media (max-width: 500px) {
    .spot-info-panel {
        top: 10px;
        width: 92%;
    }

    .spot-info-panel .panel-content {
        flex-direction: row;
        padding: 10px;
        gap: 12px;
    }

    .spot-info-panel .panel-image {
        width: 75px !important;
        height: 75px !important;
        border-radius: 8px;
    }

    .spot-info-panel .panel-title {
        font-size: 15px !important;
        margin: 0 0 4px 0 !important;
    }

    .spot-info-panel .panel-description {
        font-size: 12px !important;
        line-height: 1.4 !important;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .spot-info-panel .panel-close-btn {
        top: 8px !important;
        right: 8px !important;
        width: 24px !important;
        height: 24px !important;
    }

    .spot-info-panel .panel-close-btn .material-symbols-outlined {
        font-size: 14px !important;
    }

    .spot-info-panel .panel-details {
        padding-right: 20px !important;
    }

    #category-filter-bar {
        padding: 4px 6px;
        gap: 3px;
        max-width: 98vw;
    }

    .cat-filter-btn {
        padding: 4px 6px;
        font-size: 10px;
        gap: 2px;
        letter-spacing: 0;
    }

    .cat-filter-btn .material-symbols-outlined {
        font-size: 13px;
    }

    #gps-toggle-btn {
        padding: 4px 5px;
        gap: 2px;
        font-size: 10px;
    }

    #gps-toggle-btn .material-symbols-outlined {
        font-size: 13px;
    }
}

.spot-info-panel .panel-image {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.03);
}

.spot-info-panel .panel-image.no-image {
    display: none;
}

.spot-info-panel .panel-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #f8fafc;
    padding-right: 28px;
    /* 閉じるボタンと重ならないように */
}

.spot-info-panel .panel-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #f8fafc;
    letter-spacing: 0.3px;
}

.spot-info-panel .panel-description {
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
    color: #cbd5e1;
}

.spot-info-panel .panel-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.spot-info-panel .panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.language-selector {
    position: relative;
    padding: 6px 8px;
    pointer-events: auto;
}

.language-toggle-btn,
.language-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    background: rgba(10, 10, 16, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    color: rgba(255, 255, 255, 0.80);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.language-toggle-btn .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
}

.language-chevron {
    transition: transform 0.2s ease;
}

.language-toggle-btn[aria-expanded="true"] .language-chevron {
    transform: rotate(180deg);
}

.language-toggle-btn:hover,
.language-option:hover {
    background: rgba(10, 10, 16, 0.90);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.language-toggle-btn:focus-visible,
.language-option:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.language-options {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px 8px;
}

.language-options[hidden] {
    display: none;
}

.language-option {
    justify-content: space-between;
    width: 100%;
}

.language-option[aria-pressed="true"] {
    border-color: #3b82f6;
    color: #93c5fd;
}

.language-option[aria-pressed="true"]::after {
    content: "✓";
}

@media (max-width: 500px) {
    .language-selector,
    .language-options {
        padding: 4px 6px;
    }

    .language-toggle-btn,
    .language-option {
        padding: 4px 6px;
        font-size: 10px;
        gap: 2px;
        letter-spacing: 0;
    }

    .language-toggle-btn .material-symbols-outlined {
        font-size: 13px;
    }
}

.spot-info-panel .panel-close-btn .material-symbols-outlined {
    font-size: 16px;
}
