.search-area-container {
    display: flex;
    width: 100%;
}

.search-item {
    width: 80%;
}

.search-button {
    height: 100%;
    align-content: center;
    flex: 1;
}

.search-button button {
    background: #F58220;
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    width: 90%;
    max-width: 320px;
    display: block;
    margin: 0 auto;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.search-button button {
    transition: background 0.2s ease;
}

.search-button button:hover {
    background: rgba(252, 167, 92, 0.8);
}

.search-mode {
    display: flex;
    align-items: center;
    width: 50%;
    margin-top: 5px;
}

.search-mode select {
    height: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-right: 5px;
}

.search-mode label {
    margin-right: 0.5em;
    width: 7rem;
}

.search-result {
    width: 100%;
    overflow: auto;
}

.search-result table {
    table-layout: auto;
    width: auto;
    border-collapse: collapse;
}
.search-result th,
.search-result td {
    white-space: nowrap;
    padding: 6px 12px;
    border: 1px solid #ddd;
}

/* 詳細ページ */
.detail-container {
    width: 100%;
    overflow: hidden;
    margin-bottom: 24px;
}

.ketto-info-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.ketto-info {
    width: 100%;
    min-width: 480px;
}

.detail-back {
    margin-bottom: 16px;
}

.detail-back a {
    color: #F58220;
    text-decoration: none;
    font-weight: bold;
}

.detail-title {
    font-size: 24px;
    margin-bottom: 16px;
}

.detail-section-title {
    font-size: 18px;
    margin: 24px 0 8px;
    border-left: 4px solid #F58220;
    padding-left: 8px;
}

.detail-info {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

.detail-info th,
.detail-info td {
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-align: left !important;
}

.detail-info th {
    background: #e4ffd7;
    width: 120px;
    white-space: nowrap;
}

.detail-info td {
    width: calc(50% - 120px);
}

.detail-info-result th,
.detail-info-result td {
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-align: left !important;
}

.detail-info-result th {
    background: #e4ffd7;
    width: 120px;
    white-space: nowrap;
}

.detail-info-result td {
    width: calc(50% - 120px);
}

.ketto-info td {
    padding: 8px 16px;
    border: 1px solid #b0c4de;
    text-align: left !important;
    vertical-align: middle;
    width: 33.33%;
    border: 1px solid red;
}

.b_ml {
    background-color: #ccefff;
    color: #00008b;
}

.b_fml {
    background-color: #ffdbd5;
    color: #8b0000;
}

/* 過去のレース結果テーブル: データ長で可変・1行表示・横スクロール */
.race-result-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.race-result-wrap .race-result-table {
    width: max-content;
    table-layout: auto;
}

.race-result-wrap .race-result-table th,
.race-result-wrap .race-result-table td {
    white-space: nowrap;
    width: auto;
}

@media screen and (max-width: 768px) {
    .scrollbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .scrollbar::-webkit-scrollbar {
        display: none;
    }

    #main {
        height: auto;
        overflow: visible;
        border-width: 0;
    }

    /* main が自然な高さを持つよう content-in のflex を縦積みに変更 */
    body.database-detail-page #content-in {
        display: flex;
        flex-direction: column;
    }

    body.database-detail-page #sidebar {
        order: 2;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    /* slick スライダーが横にはみ出さないよう制限 */
    body.database-detail-page .ics-slider-wrapper,
    body.database-detail-page .ics-slider,
    body.database-detail-page .slick-list {
        max-width: 100%;
    }

    body.database-detail-page .ics-slide img,
    body.database-detail-page .author-thumb img {
        max-width: 100%;
        height: auto;
    }

    .search-mode {
        display: flex;
        align-items: center;
        width: 100%;
        margin-top: 5px;
    }

    .detail-info {
        width: 100%;
    }
    .detail-info tbody {
        display: block;
        width: 100%;
    }
    .detail-info tr {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        width: 100%;
    }
    .detail-info tr > th:nth-child(1) { grid-area: 1 / 1; }
    .detail-info tr > td:nth-child(2) { grid-area: 1 / 2; }
    .detail-info tr > th:nth-child(3) { grid-area: 2 / 1; }
    .detail-info tr > td:nth-child(4) { grid-area: 2 / 2; }    
    .detail-info td {
        width: 100%;
    }
}