/* 全体 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Yu Gothic UI", "Meiryo", sans-serif;
    background: #f3f3f3;
}

#viewer-main {
    min-height: calc(100vh - 110px);
}

#kp-search {
    position: sticky;
    top: 56px;
    z-index: 900;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #d9e2dc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#kp-search label {
    display: grid;
    gap: 4px;
    color: #334139;
    font-size: 12px;
    font-weight: 700;
}

#kp-search select,
#kp-search input,
#kp-submit,
#gps-submit {
    min-height: 40px;
    border: 1px solid #aebbb3;
    border-radius: 8px;
    font: inherit;
}

#kp-search select,
#kp-search input { padding: 8px 10px; background: #fff; }
#kp-search input { width: 120px; border: 0; }
.kp-input-wrap { display: flex; align-items: center; background: #fff; border: 1px solid #aebbb3; border-radius: 8px; padding-right: 10px; font-weight: 600; }
#kp-submit,
#gps-submit { padding: 8px 18px; border-color: #007f31; background: #00973a; color: #fff; font-weight: 700; cursor: pointer; }
#kp-submit:hover,
#gps-submit:hover { background: #007f31; }
#kp-submit:disabled,
#gps-submit:disabled { background: #9aa69e; border-color: #9aa69e; cursor: not-allowed; }
#gps-submit { border-color: #375e48; background: #fff; color: #235338; }
#gps-submit:hover { background: #e8f5ec; }
#gps-submit:disabled { border-color: #9aa69e; background: #f0f2f1; color: #6f7b74; }
#kp-error { color: #b42318; font-size: 12px; max-width: 220px; }
#kp-error.is-notice { color: #526159; }
#gps-status { max-width: 310px; color: #526159; font-size: 12px; }
#gps-status.is-success { color: #176b36; }
#gps-status.is-error { color: #b42318; }
#gps-debug[hidden] { display: none; }
#gps-debug { position: relative; font-size: 12px; color: #334139; }
#gps-debug summary { min-height: 40px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.gps-debug-fields { position: absolute; top: calc(100% + 8px); right: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 110px); gap: 10px; width: max-content; padding: 12px; background: #fff; border: 1px solid #aebbb3; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.16); }
.gps-debug-fields label { display: grid; gap: 4px; }
.gps-debug-fields input { width: 110px !important; min-height: 36px !important; border: 1px solid #aebbb3 !important; }
#debug-gps-submit { grid-column: 1 / -1; min-height: 36px; border: 1px solid #375e48; border-radius: 8px; background: #e8f5ec; color: #235338; font-weight: 700; cursor: pointer; }
.load-error { margin: 40px auto; padding: 18px; color: #8a1c12; background: #fff1f0; border-radius: 8px; }

#app {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 16px 20px 20px;
}

svg {
    background: #fff;
    border: 1px solid #ccc;
    display: block;
    height: auto;
}

/* スマホだけ */
@media (max-width: 799px) {
    svg {
        width: 100%;
    }
}

#kp-ui {
    position: fixed;
    right: 12px;
    bottom: 52px;
    z-index: 9999;
}

#kp-ui[hidden] { display: none; }

.street-view-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 999px;
    background: #1769e0;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.24);
    font: 700 14px/1 sans-serif;
    text-decoration: none;
}

.street-view-button:hover { background: #0e58c7; }
.street-view-button:focus-visible { outline: 3px solid #f5b700; outline-offset: 3px; }
.street-view-button span { font-size: 18px; line-height: 1; }

#zoom-controls {
    position: fixed;
    right: 10px;
    bottom: 10px;
    z-index: 9999;
}

.zoom-slider { display: block; }
.zoom-buttons { display: none; }

#topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    
    height: 56px;
    display: flex;
    align-items: center;
    gap: 20px;
    
    padding: 0 18px;
    
    background: #00973a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

#app-title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    color: #fff;
    text-decoration: none;
    min-width: 120px;
}

.app-title-main {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-title-sub {
    margin-top: 3px;
    font-size: 11px;
    color: #cbe1d2;
}

#route-title {
    padding-left: 18px;
    border-left: 1px solid rgba(255,255,255,0.25);
    font-size: 15px;
    font-weight: 600;
    color: #f8fafc;
}

.road,
.structure-body {
    cursor: crosshair;
}

.facility,
.structure-label {
    cursor: pointer;
}

#mini-map {
    position: fixed;
    top: 286px;
    right: 10px;
    width: 220px;
    height: 180px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    z-index: 9998;
    overflow: hidden;
}

.mini-map-resize-handle {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
    z-index: 1000;
    padding: 0;
    border: 0;
    border-radius: 0 7px 0 7px;
    background: rgba(255, 255, 255, 0.88);
    cursor: nesw-resize;
    touch-action: none;
}

.mini-map-resize-handle::before {
    content: "";
    position: absolute;
    left: 6px;
    bottom: 6px;
    width: 9px;
    height: 9px;
    border-left: 2px solid #52635a;
    border-bottom: 2px solid #52635a;
}

.mini-map-resize-handle:hover,
.mini-map-resize-handle:focus-visible {
    background: #ffffff;
    outline: 2px solid #087f3e;
    outline-offset: -2px;
}

body.mini-map-resizing {
    cursor: nesw-resize;
    user-select: none;
}

@media (max-width: 799px) {
    #mini-map {
        display: none;
    }

    #kp-search { align-items: end; gap: 8px; padding: 10px; }
    #kp-search label { font-size: 11px; }
    #kp-search select { width: 88px; }
    #kp-search input { width: 92px; }
    #kp-submit,
    #gps-submit { padding-inline: 12px; }
    #kp-error { position: absolute; top: 100%; left: 10px; background: #fff; }
    #gps-status { position: absolute; top: 100%; right: 10px; max-width: calc(100% - 20px); background: #fff; }
    #gps-debug { position: static; }
    .gps-debug-fields { position: fixed; top: 166px; left: 10px; right: 10px; grid-template-columns: 1fr; width: auto; }
    .gps-debug-fields input { width: 100% !important; }
    #kp-ui {
        right: auto;
        left: 12px;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }
    .street-view-button {
        gap: 5px;
        min-height: 36px;
        padding-inline: 11px;
        font-size: 11px;
    }
    .street-view-button span { font-size: 13px; }

    #zoom-controls {
        right: auto;
        left: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .zoom-slider { display: none; }
    .zoom-buttons {
        display: flex;
        overflow: hidden;
        border: 1px solid #aebbb3;
        border-radius: 10px;
        background: rgba(255,255,255,0.96);
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    .zoom-buttons button {
        min-width: 38px;
        min-height: 38px;
        padding: 0 10px;
        border: 0;
        border-right: 1px solid #d9e2dc;
        background: transparent;
        color: #26332c;
        font: 700 18px/1 sans-serif;
        cursor: pointer;
        touch-action: manipulation;
    }
    .zoom-buttons button:last-child { border-right: 0; }
    .zoom-buttons button:disabled { color: #aeb7b1; }
    .zoom-buttons button:focus-visible { outline: 3px solid #f5b700; outline-offset: -3px; }
}

.home {
    width: min(960px, calc(100% - 32px));
    padding: 24px;
}

.hero {
    padding: 28px 32px;
    background: linear-gradient(135deg, #00973a, #00722e);
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
}

.hero-kicker {
    font-size: 12px;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 8px;
}

.hero h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.hero p {
    font-size: 14px;
    color: #e8f5ec;
}

.route-panel {
    margin-top: 24px;
    padding: 22px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.route-panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
}

.route-list a {
    display: block;
    padding: 14px 16px;
    margin-top: 10px;
    color: #222;
    text-decoration: none;
    background: #f8faf8;
    border: 1px solid #d7e5dc;
    border-radius: 10px;
    font-weight: 600;
}

.route-list a:hover {
    background: #edf8f1;
    border-color: #00973a;
}

.area-navigation {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #d9e2dc;
    font-size: 14px;
}

.area-navigation a {
    color: #176b36;
    font-weight: 700;
}

.copyright {
    font-size: 10px;
    line-height: 1.5;
    color: #68716b;
    text-align: center;
    margin-top: 18px;
    padding: 8px 12px 12px;
}

.copyright a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.source-notice {
    font-size: 13px;
    line-height: 1.8;
}

.source-notice li + li {
    margin-top: 8px;
}

#current-location-panel {
    position: fixed;
    left: 10px;
    bottom: 10px;
    z-index: 9999;
  
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px 10px;
  
    font-family: sans-serif;
    font-size: 12px;
    line-height: 1.5;
  
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  
  #current-location-panel .cl-title {
    font-weight: bold;
    margin-bottom: 2px;
  }
