* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background-color: #f5f6f8;
    color: #222;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.modal-open {
    overflow: hidden;
}

.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex: 0 0 auto;
}

/* タイトル本体 */
.site-title {
    font-family: "Yomogi", cursive;
    font-size: 40px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
    cursor: pointer;
}

/* 東京版を軽くする */
.site-region {
    font-size: 24px;
    font-weight: 500;
    color: #777;
    margin-left: 6px;
}

.site-subtitle {
    font-family: "Yomogi", cursive;
    font-size: 20px;
    color: #777;
    letter-spacing: 0.04em;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: "Yomogi", cursive;
    letter-spacing: 0.04em;
}

.site-header h1 {
    margin: 0 0 8px 0;
    font-size: 36px;
}

.site-header p {
    margin: 0;
    color: #666;
}

.layout {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.left-panel {
    flex: 0 0 27%;
    max-width: 27%;
    min-width: 260px;
    padding-right: 16px;
    border-right: 4px solid #e5e5e5;
    height: 100%;
    overflow: auto;
}

.right-panel {
    flex: 1 1 0;
    max-width: calc(73% - 20px);
    min-width: 0;
    height: 100%;
    overflow: auto;
    scroll-margin-top: 96px;
}

.search-box,
.course-card,
.detail-box,
.right-panel {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.course-list {
    margin-top: 20px;
}

.course-card {
    margin-bottom: 16px;
}

.course-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}

.course-card-meta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.course-card-meta-row p {
    margin: 0;
}

.right-panel h2 {
    margin-top: 0;
    font-size: 26px;
}

.detail-box {
    margin-top: 20px;
}

.course-summary-box {
    margin-top: 10px;
}

.course-summary-box p {
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.45;
}

.course-map-box h3 {
    margin-top: 6px;
    margin-bottom: 22px;
}

.course-meta-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.course-meta-row p {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 16px;
    align-items: stretch;
    margin-top: 20px;
}

.detail-grid-no-map {
    grid-template-columns: minmax(0, 1fr);
}

.detail-main,
.detail-side {
    min-width: 0;
}

.detail-side {
    display: flex;
    align-self: stretch;
}

.detail-grid .detail-box {
    margin-top: 0;
}

.detail-side .detail-box {
    height: auto;
    width: 100%;
    min-height: 0;
    overflow: auto;
}

.search-box form {
    display: flex;
    gap: 10px;
    margin: 0;
    align-items: stretch;
}

.search-box input {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.search-box button {
    padding: 12px 16px;
    min-width: 90px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background-color: #333;
    color: white;
    cursor: pointer;
}

.search-box button:hover {
    background-color: #555;
}

/* スマホ対応 */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow: auto;
    }

    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
        padding: 12px 14px;
    }

    .site-title {
        font-size: 28px;
    }

    .site-region {
        font-size: 18px;
    }

    .site-subtitle {
        display: block;
        font-size: 12px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 4px;
    }

    .layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 90px 10px 10px;
        gap: 10px;
        overflow: visible;
    }

    .left-panel {
        display: contents;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;
        height: auto;
        overflow: visible;
    }

    .search-box {
        order: 1;
    }

    .message-box {
        order: 2;
        margin-top: 0;
    }

    .right-panel {
        order: 3;
    }

    .course-list {
        order: 4;
        margin-top: 0;
    }

    .site-header h1 {
        font-size: 26px;
    }

    .right-panel h2 {
        font-size: 21px;
        margin-bottom: 8px;
    }

    .course-meta-row {
        gap: 10px 18px;
        margin-bottom: 0;
    }

    .right-panel {
        display: flex;
        flex-direction: column;
        padding: 12px;
    }

    .detail-box {
        padding: 12px;
        margin-top: 12px;
    }

    .detail-grid {
        display: contents;
    }

    .detail-main {
        order: 4;
        margin-top: 18px;
    }

    .detail-main .detail-box {
        margin-top: 0;
    }

    .course-summary-box {
        order: 3;
        margin-top: 8px;
        margin-bottom: 0;
    }

    .detail-side {
        order: 5;
        margin-top: 12px;
    }

    .detail-side .detail-box {
        margin-top: 0;
    }

    /* .search-box form {
        flex-direction: column;
    } */

    .search-box form {
        display: flex;
        gap: 8px;
    }

    .search-box input {
        flex: 1;
    }

    .search-box button {
        white-space: nowrap;
        padding: 8px 12px;
    }

    /* .search-box input,
    .search-box button {
        width: 100%;
    } */

    .thumb {
        height: 180px;
    }

    /* モバイルでは候補カードを圧縮表示して一覧性を上げる */
    .course-card {
        padding: 10px;
        margin-bottom: 10px;
    }

    .course-card h3 {
        font-size: 16px;
        margin: 0 0 6px 0;
        line-height: 1.35;
    }

    .course-card p {
        margin: 2px 0;
        font-size: 13px;
        line-height: 1.35;
    }

    .course-card-meta-row {
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .course-card-meta-row p {
        white-space: nowrap;
    }

    /* モバイルでも概要文を表示 */
    .course-card p:last-of-type {
        display: block;
    }

    .thumb {
        height: 96px;
        margin-bottom: 6px;
    }
}

.course-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.course-card-link:hover .course-card {
    transform: translateY(-2px);
    transition: 0.2s;
}

.message-box {
    background-color: #fff7e6;
    border: 1px solid #f0d8a8;
    border-radius: 12px;
    padding: 14px;
    margin-top: 16px;
}

.spot-list {
    padding-left: 20px;
}

.spot-list li {
    margin-bottom: 14px;
    line-height: 1.7;
}

.spot-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.spot-map-link {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid #cfd8e3;
    border-radius: 999px;
    color: #2563eb;
    background: #f8fbff;
    font-size: 12px;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
}

.spot-map-link:hover {
    background: #eef5ff;
    border-color: #a8c6f7;
}

.autocomplete {
    position: relative;
}

.suggestion-box {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    z-index: 30;
    display: none;
    overflow: hidden;
}

.suggestion-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fff;
    font-size: 15px;
    line-height: 1.5;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f7f7f7;
}

.route-preview {
    width: 100%;
    display: block;
    border-radius: 12px;
    border: 1px solid #d7deea;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.10);
    max-width: none;
}

.route-preview-figure {
    width: 100%;
    margin: 0;
}

.route-preview-attribution {
    margin-top: 6px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
}

.route-preview-attribution a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.route-preview-button {
    cursor: zoom-in;
}

.map-preview-note {
    margin: 10px 0 0;
    color: #5b6475;
    font-size: 14px;
}

.detail-box-map {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.route-leaflet-map {
    width: 100%;
    max-width: 546px;
    aspect-ratio: 1 / 1;
    height: auto;
    position: relative;
    z-index: 0;
    isolation: isolate;
    border-radius: 12px;
    border: 1px solid #d7deea;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.10);
    overflow: hidden;
}

.spot-number-marker {
    background: transparent;
    border: none;
}

.station-s-marker {
    background: transparent;
    border: none;
}

.station-s-marker span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    position: relative;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.spot-number-marker span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    position: relative;
    background: #dc2626;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.station-s-marker span::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -11px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #ffffff;
}

.station-s-marker span::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #1d4ed8;
}

.spot-number-marker span::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -11px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #ffffff;
}

.spot-number-marker span::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #dc2626;
}

.detail-heading-inline {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-heading-note {
    font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    letter-spacing: 0;
}

.map-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.map-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.map-preview-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1100px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-preview-modal-image {
    width: 100%;
    max-height: 88vh;
    display: block;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.34);
    object-fit: contain;
}

.map-preview-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}

@media (max-width: 768px) {
    .route-preview {
        max-width: 100%;
    }

    .route-leaflet-map {
        max-width: 100%;
    }

    .map-preview-dialog {
        width: 94vw;
        min-height: 100vh;
        margin: 0 auto;
        padding: 10px;
    }

    .map-preview-close {
        top: 12px;
        right: 12px;
    }
}


.thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 8px;
}

iframe {
    width: 100%;
    border-radius: 12px;
}
