html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f9;
    color: #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    padding-top: 52px;
    /* .controls-area の高さ分を確保 */
}

.controls-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 5px 10px;
    background-color: white;
    /*box-shadow: 0 2px 5px rgba(0,0,0,0.1);*/
    z-index: 20;
    /* 他の要素より手前に */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: top 0.3s ease-in-out;
    min-height: 50px;
    /* 最小高さを設定 */
    box-sizing: border-box;
}

.controls-area.hidden {
    top: -100%;
    /* 画面外へ移動 */
    box-shadow: none;
}

.dropdown-container {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 300px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1;
    padding: 10px;
    border-radius: 8px;
    flex-direction: column;
    gap: 10px;
}

#settings-dropdown {
    right: 0;
    /* 右端に表示 */
    left: auto;
    min-width: 250px;
    /* 経路設定と幅を合わせる */
}

.dropdown-content.show {
    display: flex;
}

/* 【マップ】表示タイプ・オプション */
#map-controls-container {
    display: flex;
    flex-direction: column;
    margin: 12px;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px 5px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.map-overlay-control {
    opacity: 0;
    /* デフォルトでは非表示（透明） */
    transition: opacity 0.3s ease-in-out;
    /* スムーズに表示/非表示 */
    pointer-events: none;
    /* 非表示中はクリックできないようにする */
}

#map:hover .map-overlay-control {
    opacity: 1;
    pointer-events: auto;
    /* 表示中はクリックできるようにする */
}

.item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

#map-controls-container label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

/* トグルスイッチのスタイル */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #2196F3;
    /* 青色 */
}

input:checked+.slider:before {
    transform: translateX(14px);
}

.dropdown-content input[type="text"] {
    padding: 8px;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dropdown-content button {
    width: 100%;
}

.input-group,
.action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.control-groups {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

#settings-container {
    margin-left: auto;
    /*設定・フルスクリーンボタンを右寄せ*/
}

#speed-input {
    width: 60px;
    padding: 8px;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

button {
    padding: 8px 15px;
    font-size: 0.9rem;
    color: white;
    background-color: #3498db;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#split-container {
    display: flex;
    flex-grow: 1;
    position: relative;
}

#main-container.toolbar-hidden {
    padding-top: 0;
    transition: padding-top 0.3s ease-in-out;
}

#map,
#street-view {
    height: 100%;
    position: relative;
}

#street-view {
    flex-grow: 0.7;
    flex-basis: 70%;
}

#map {
    flex-grow: 0.3;
    flex-basis: 30%;
}

#message-box {
    position: absolute;
    top: 50px;
    /*bottom: 20px;*/
    left: 50%;
    transform: translateX(-50%);
    background-color: #e74c3c;
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#speed-overlay {
    /*スピードオーバーレイ表示*/
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* 子要素を右寄せにする */
    position: absolute;
    width: 86px;
    bottom: 24px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #7fff00;
    gap: 0px 0px;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

#speed-overlay #speed-value {
    margin-top: -14px;
    margin-right: 4px;
    font-size: 3rem;
    font-weight: bold;
}

.decimal-small {
    /*小数点以下を小さく*/
    font-size: 1.5rem;
}

#speed-overlay #speed-unit {
    color: white;
    margin-bottom: -14px;
    margin-right: 4px;
    font-weight: bold;
    transform: translateY(-14px);
    /*力技で行間詰め*/
}


.mode-switcher {
    display: flex;
    background-color: #eee;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-switcher button {
    background-color: white;
    color: #3498db;
    padding: 5px 5px;
    margin: 3px;
    border-radius: 10px;
    box-shadow: none;
    transition: background-color 0.2s, color 0.2s;
}

.mode-switcher button.active {
    background-color: #3498db;
    color: white;
}

#info-display {
    background-color: transparent;
    /* 背景を完全に透明にする */
    position: relative;
    /* z-indexを有効にするため */
    z-index: 1;
    /* グラフより手前に表示 */
    color: #333;
    /* デフォルトの文字色を濃いグレーに */
    padding: 0;
    margin-left: 30px;
    /*グラフの目盛りと重ならないように*/
    display: flex;
    flex-wrap: wrap;
    gap: 5px 15px;
    /* 横のgapを詰める */
    justify-content: flex-start;
    /* 左詰めにする */
    /*box-shadow: 0 2px 5px rgba(0,0,0,0.2);*/
    font-size: 0.9rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    /* 利用可能なスペースを均等に埋める */
}

.info-item-no-grow {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 0;
    /* アイテムの幅に固定 */
}

.info-label {
    font-weight: bold;
    color: #7f8c8d;
    /* ラベルの文字色を少し薄いグレーに */
}

.info-value {
    font-size: 1.1rem;
    color: white;
    /* 値の文字色を白に */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    /* 影をつけて読みやすくする */
}

#lang-switcher {
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.lang-btn:hover {
    background-color: #bdc3c7;
    transform: none;
}

.lang-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

#fullscreen-button {
    background-color: transparent;
    border: none;
    box-shadow: none;
    width: 40px;
    height: 40px;
    padding: 0px;
    cursor: pointer;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fullscreen-button:hover {
    background-color: #ecf0f1;
    transform: none;
}

#hide-toolbar-button {
    background-color: transparent;
    border: none;
    box-shadow: none;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hide-toolbar-button:hover {
    background-color: #ecf0f1;
    transform: none;
}

.infowindow-btn {
    margin: 2px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: white;
    background-color: #3498db;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.infowindow-content {
    color: #333;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}

.infowindow-content .place-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.infowindow-content .place-address {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.infowindow-content .place-address .country-name,
.postal-code {
    display: none;
}

.infowindow-content .place-distance {
    font-size: 14px;
    color: #333;
    margin-top: 8px;
    margin-bottom: 4px;
}

.infowow-btn:hover {
    background-color: #2980b9;
}

#boost-button {
    display: block;
    /* Initially hidden */
    background-color: transparent;
    border: 1px solid #bdc3c7;
    color: #bdc3c7;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-top: 2px;
    border-radius: 50%;
    box-shadow: none;
    transform: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

#boost-button.active {
    background-color: #f1c40f;
    color: white;
    border-color: #f1c40f;
}

#boost-button svg {
    margin-top: 1px;
    width: 18px;
    /* ボタンの幅に対する割合でサイズを指定 */
    height: 20px;
}


/* Google Places Autocomplete suggestions z-index fix */
.pac-container {
    z-index: 2001;
    /* Must be higher than .modal-overlay's z-index */
}


/* Responsive design for mobile */
@media (max-width: 767px) {
    .controls-area {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .input-group,
    .action-group {
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }

    .input-group label {
        width: 100%;
        text-align: left;
    }

    #origin-input,
    #destination-input,
    #speed-input,
    button {
        width: 100%;
    }

    .dropdown-content {
        min-width: auto;
        width: 100%;
    }

    #split-container {
        flex-direction: column;
    }

    #street-view,
    #map {
        flex-basis: auto;
        height: 50%;
        width: 100%;
    }

    /*.splitter {
        height: 8px;
        width: 100%;
        cursor: row-resize;
    }*/
    .mode-switcher {
        width: 100%;
    }

    #info-display {
        gap: 5px;
        padding: 0;
        justify-content: center;
    }

    .info-item {
        flex-basis: 45%;
        align-items: flex-start;
    }
}

#elevation-chart-container {
    width: 100%;
    height: 80px;
    /* 少し高さを詰める */
    background-color: #2c3e50;
    /* 背景色を戻す */
    padding: 10px 0 0;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: block;
    /* Initially hidden */
    margin-top: -25px;
    /* info-displayと30pxオーバーラップさせる */
}

/*
#direction-settings-dropdown {
    padding: 5px;
}
#direction-switcher {
    border: none;
}
*/
#elevation-chart {
    width: 100%;
    height: 100%;
    cursor: not-allowed;
    /* Initially not clickable */
}

/* 【ストリートビュー】表示方向 */
#direction-control-overlay {
    /*display: flex;*/
    /*flex-direction: column;*/
    position: absolute;
    bottom: 10px;
    left: 50%;
    z-index: 5;
    /* ストリートビューのUIより手前に表示 */
    transform: translateX(-50%);
    /* 要素の幅の半分だけ左にずらして中央揃え */
    margin-bottom: 12px;
    /* Googleロゴなどを隠さないように */
}

.sv-overlay-control {
    opacity: 0;
    /* デフォルトでは非表示（透明） */
    transition: opacity 0.3s ease-in-out;
    /* スムーズに表示/非表示 */
    pointer-events: none;
    /* 非表示中はクリックできないようにする */
}

/* ストリートビューにホバーしたときに方向コントロールを表示 */
#street-view:hover .sv-overlay-control {
    opacity: 1;
    pointer-events: auto;
    /* 表示中はクリックできるようにする */
}

/* オートブースト設定 */
#auto-boost-settings {
    display: none;
    /* 初期状態では非表示 */
}

#auto-boost-settings-dropdown {
    min-width: 180px;
    padding: 15px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.settings-item label {
    white-space: nowrap;
}

.settings-item select {
    flex-shrink: 0;
    /* 幅が縮まないようにする */
}

.settings-item label {
    flex-grow: 1;
    /* ラベルが利用可能なスペースを埋める */
}

.settings-item select {
    flex-grow: 1;
    /* 残りのスペースをすべて使う */
}

.settings-item switch {
    width: 70px;
    /* 固定幅を指定 */
    flex-shrink: 0;
    /* 幅が縮まないようにする */
}

.settings-item input[type="number"] {
    width: 70px;
    /* 固定幅を指定 */
    flex-shrink: 0;
    /* 幅が縮まないようにする */
}

#settings-dropdown #lang-switcher {
    justify-content: center;
    margin-bottom: 10px;
}

#settings-dropdown input[type="number"],
#settings-dropdown select {
    padding: 8px;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ratio-switcher {
    overflow: hidden;
    /*    display: flex;
    border-radius: 8px;
    border: 1px solid #bdc3c7;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);*/
}

.switch-button-container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border: none;
    border-radius: 8px;
    /*box-shadow: 0 2px 6px rgba(0,0,0,0.3);*/
    /* 左上からの明るい影 */
    box-shadow:
        inset 5px 5px 10px #c0c0c0,

        /* 右下からの暗い影 */
        inset -5px -5px 10px #ffffff;
    display: flex;
    gap: 2px;
}

.switch-button-container button {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    box-shadow: none;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.switch-button-container button.active {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}

/* 自作ストリートビューUIコントロールのコンテナ */
#sv-custom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 自作ストリートビューUIボタンの共通スタイル */
.sv-control-button {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
}

.sv-control-button:hover {
    background-color: #f0f0f0;
}

/* 自作ズームボタンのグループ */
.sv-zoom-control-group {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    /* コンテナの角を丸める */
    overflow: hidden;
    /* 中のボタンの角をマスクする */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.sv-zoom-control-group .sv-control-button {
    border-radius: 0;
    /* 個々のボタンの角丸はリセット */
    border-bottom: 1px solid #ccc;
    /* ボタンの間に境界線を追加 */
    box-shadow: none;
    /* 親の影を適用するので個々の影は不要 */
}

.sv-zoom-control-group .sv-control-button:last-child {
    border-bottom: none;
    /* 最後のボタンの下線は不要 */
}

/* 【マップ】フルスクリーン・ズームボタン */
#map-custom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    /*z-index: 5;*/
    margin: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}