.race-info {
    padding: 15px;
    font-size: 16px;
    margin-top: -20px !important;
    position: relative;
    z-index: 1;
    /* ヘッダーより背面 */
}

.table-wrapper {
    overflow-x: auto;
    max-width: 100vw;
}

.table-wrapper-scrollable {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    background-color: white;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    margin-bottom: 20px;
    text-align: center;
}

th,
td {
    padding: 6px 8px;
    border: 1px solid #ddd;
    white-space: normal;
    background: white;
    box-sizing: border-box;
    height: auto;
    line-height: normal;
    word-break: break-word;
}

/* === 固定関連 === */

/* 通常のヘッダーセル */
thead th {
    position: sticky;
    top: 0;
    z-index: 90;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ccc;
    height: 56px;
    padding: 8px 6px !important;
    display: table-cell;
    font-size: 14px;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
}

/* 左上セル（1行1列目） */
thead th:first-child {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 100;
    background: #f0f0f0;
    font-weight: bold;
    white-space: normal;
    text-align: center;
}

/* 左端列（tbody） */
tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 80;
    background: white;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-weight: normal;
}

/* === 枠番色 === */
thead th.racer_0,
tbody td.racer_0 {
    background-color: white;
    color: black;
    font-weight: bold;
}

thead th.racer_1,
tbody td.racer_1 {
    background-color: black;
    color: white;
    font-weight: bold;
}

thead th.racer_2,
tbody td.racer_2 {
    background-color: red;
    color: white;
    font-weight: bold;
}

thead th.racer_3,
tbody td.racer_3 {
    background-color: blue;
    color: white;
    font-weight: bold;
}

thead th.racer_4,
tbody td.racer_4 {
    background-color: yellow;
    color: black;
    font-weight: bold;
}

thead th.racer_5,
tbody td.racer_5 {
    background-color: green;
    color: white;
    font-weight: bold;
}

/* === 「〇号艇」と名前のスタイル === */
thead th .frame-num,
thead th .racer-name {
    display: block;
    text-align: center;
    font-size: 1.1em;
    line-height: 1.2;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

/* === ハイライト用 === */
.highlightMax {
    color: red;
    font-weight: bold;
}

.highlightMin {
    color: blue;
    font-weight: bold;
}

/* === スマホ対応 === */
@media (max-width: 600px) {
    .race-info p {
        font-size: 14px;
    }

    th,
    td {
        padding: 4px 6px;
        font-size: 13px;
    }

    tbody td:first-child {
        white-space: normal;
        font-size: 12px;
        padding-left: 4px;
        padding-right: 4px;
        max-width: 120px;
        overflow-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    table {
        font-size: 12px;
        min-width: auto;
        width: 100%;
    }

    thead th .frame-num,
    thead th .racer-name {
        font-size: 0.9em;
    }

    /* スマホでもラウンドボタン横並び維持 */
    .round-grid {
        flex-direction: row !important;
        justify-content: flex-start !important;
        flex-wrap: wrap;
    }

    .round-btn {
        width: auto !important;
        min-width: 48px;
        display: inline-flex !important;
        flex: 0 0 auto !important;
        padding: 6px 12px;
        box-sizing: border-box;
        white-space: nowrap;
    }
}

/* === コース2連率だけフォント小さく === */
tbody td.course2Rate {
    font-size: 0.8em !important;
}

/* === 検索フォームなどその他 === */
.search-form {
    margin-bottom: 1.5em;
    padding: 1em;
    background-color: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 10px !important;
}

.search-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: center;
}

.search-form label {
    font-weight: bold;
}

.search-form input,
.search-form select,
.search-form button {
    padding: 0.4em 0.6em;
    font-size: 1em;
}

/* === 購入候補 === */
.purchase-candidates {
    margin-top: 30px;
    padding: 15px;
    border: 2px solid #0a6fbd;
    border-radius: 8px;
    background-color: #f4f9ff;
    max-width: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.purchase-candidates h2 {
    color: #0a6fbd;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 12px;
    border-bottom: 2px solid #0a6fbd;
    padding-bottom: 4px;
}

.purchase-candidates ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.purchase-candidates li {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #c4d9f8;
    font-size: 1.1rem;
    color: #222;
    cursor: default;
    text-align: center;
    box-shadow: 0 2px 5px rgba(10, 111, 189, 0.15);
}

.purchase-candidates li:hover {
    box-shadow: 0 4px 8px rgba(10, 111, 189, 0.25);
}

.info-popup {
    position: absolute;
    background: white;
    padding: 6px 10px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-top: -45px;
    margin-left: 160px;
    display: none;
}


.info-popup.show {
    display: block !important;
}

@media screen and (max-width: 660px) {
    .search-form form {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-form label,
    .search-form input,
    .search-form select,
    .search-form button {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .info-popup {
        margin-left: 5px;
    }
}

/* === その他UI === */
.hit {
    background-color: gold;
    font-weight: bold;
    padding: 0.2em 0.5em;
    border-radius: 4px;
}

.round-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-start;
    /* 横並び左寄せ */
}

.round-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #f8f8f8;
    cursor: pointer;
    min-width: 48px;
    font-size: 14px;
    border-radius: 4px;
    text-align: center;
    flex: 0 0 auto;
    width: auto;
    /* 幅を中身に合わせる */
    max-width: 100%;
    /* 親幅超え防止 */
}

.round-btn.disabled {
    background: #eee;
    cursor: not-allowed;
}

.round-btn.selected {
    background: #007bff;
    color: white;
    font-weight: bold;
}

@media (max-width: 480px) {
    .round-grid {
        justify-content: flex-start;
    }

    .round-btn {
        font-size: 12px;
        min-width: 40px;
        padding: 5px 8px;
        width: auto;
        max-width: 100%;
    }
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.popup-content {
    background: white;
    padding: 20px;
    border-radius: 6px;
    max-height: 90vh;
    overflow-y: auto;
}

thead tr {
    display: table-row !important;
}

.info-icon {
    display: inline-block;
    background: #ccc;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    font-size: 12px;
    margin-left: 4px;
    cursor: pointer;
}

.bottom-ad {
    position: fixed;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px;
}

.bottom-ad.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.share-button,
.share-link {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.share-button {
    background-color: #0078d7;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    transition: background-color 0.2s, transform 0.1s;
}

.share-button:hover {
    background-color: #005fa3;
}

.share-button:active {
    transform: scale(0.97);
}

.share-button:hover {
    background-color: #005fa3;
}

.share-button:active {
    transform: scale(0.97);
}

.share-link.twitter {
    background-color: #1da1f2;
}

.share-link.facebook {
    background-color: #1877f2;
}

.share-link.line {
    background-color: #00b900;
}

.share-link:hover {
    opacity: 0.8;
}

.site-footer {
    padding-bottom: 75px;

}

.note-section {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.note-banner h2 {
    font-size: 1.4rem;
    color: #0a6fbd;
    margin-bottom: 12px;
}

.note-content p {
    font-size: 1rem;
    color: #333;
    margin-bottom: 20px;
}

.note-link {
    display: inline-block;
    background-color: #41c9b4;
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

.note-link:hover {
    background-color: #35a895;
}