@charset "utf-8";

/* 全体の背景色 */
body {
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

.main {
    width: 1200px;
    margin: 0 auto;
    font-size: 80%;
    padding: 20px;
}

h1 {
    border-bottom: 1px solid #333;
    color: #333;
}

h2 {
    color: #333;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* テーブルのスタイリング */
table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

th {
    background-color: #333333;
    color: #f5f5f5;
    border: 1px solid #f5f5f5;
    padding: 8px 5px;
    text-align: center;
    font-weight: bold;
}

td {
    padding: 8px 5px;
    border: 1px solid #f5f5f5;
    background-color: white;
    text-align: center;
}

/* 角の丸み調整 */
table tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

table tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

table tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

table tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* リンクのスタイル */
a {
    color: #333;
    text-decoration: none;
}

a:hover {
    color: #666;
    text-decoration: underline;
}

/* 数値の右寄せ */
td:nth-child(n+2):nth-child(-n+10) {
    text-align: right;
}

/* 馬名のリンクは左寄せ */
td:first-child {
    text-align: left;
}

/* タブレット対応 */
@media screen and (max-width: 1240px) {
    .main {
        width: calc(100% - 16px);
        margin: 0 8px;
    }
}

/* スマホ対応 */
@media screen and (max-width: 767px) {
    .main {
        width: 86%;
        margin: 0 auto;
        font-size: 70%;
        padding: 10px;
    }
    
    /* すべてのテーブルを横スクロール可能にするラッパー */
    /* table-responsiveクラスを持つdivにoverflow-xを適用 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* iOSでのスムーズなスクロール */
        margin-bottom: 20px; /* テーブル間の余白を確保 */
    }

    /* .table-responsive内のテーブルの幅を広げて横スクロールを有効化 */
    .table-responsive table {
        width: auto; /* テーブルの幅を内容に合わせて自動調整 */
        min-width: 600px; /* 必要に応じて最小幅を設定し、横スクロールを強制 */
    }

    /* セル内のテキストが改行されないようにする */
    .table-responsive th,
    .table-responsive td {
        white-space: nowrap; 
    }

    /* 本年成績テーブルの列幅調整 */
    .table-responsive .current-year-stats th,
    .table-responsive .current-year-stats td {
        min-width: 80px; 
    }

    /* 年度別成績テーブルの列幅調整 */
    .table-responsive .yearly-stats th,
    .table-responsive .yearly-stats td {
        min-width: 70px; 
    }
    .table-responsive .yearly-stats th:first-child,
    .table-responsive .yearly-stats td:first-child {
        min-width: 50px; /* 「年」列の最小幅 */
    }
    .table-responsive .yearly-stats th:nth-child(6),
    .table-responsive .yearly-stats td:nth-child(6), /* 重賞勝利 */
    .table-responsive .yearly-stats th:nth-child(7),
    .table-responsive .yearly-stats td:nth-child(7) { /* S1以上 */
        min-width: 80px;
    }
    .table-responsive .yearly-stats th:nth-child(8),
    .table-responsive .yearly-stats td:nth-child(8), /* 勝率 */
    .table-responsive .yearly-stats th:nth-child(9),
    .table-responsive .yearly-stats td:nth-child(9), /* 連対率 */
    .table-responsive .yearly-stats th:nth-child(10),
    .table-responsive .yearly-stats td:nth-child(10), /* 複勝率 */
    .table-responsive .yearly-stats th:nth-child(11),
    .table-responsive .yearly-stats td:nth-child(11) { /* 賞金 */
        min-width: 90px;
    }

    /* 騎手別成績テーブルの調整 */
    .table-responsive .jockey-stats th,
    .table-responsive .jockey-stats td {
        min-width: 70px; 
    }
    .table-responsive .jockey-stats th:first-child,
    .table-responsive .jockey-stats td:first-child {
        min-width: 120px; /* 騎手名の最小幅 */
    }

    /* 管理馬一覧テーブルの調整 */
    .table-responsive .Kanriba th,
    .table-responsive .Kanriba td {
        min-width: 80px; 
    }
    .table-responsive .Kanriba th:first-child,
    .table-responsive .Kanriba td:first-child {
        min-width: 100px; /* 馬名の最小幅 */
    }
    .table-responsive .Kanriba th:nth-child(4),
    .table-responsive .Kanriba td:nth-child(4) {
        min-width: 150px; /* 主な勝鞍の最小幅 */
        text-align: left; /* 主な勝鞍は左寄せに戻す */
    }


    /* 見出しのフォントサイズ調整 */
    h1 {
        font-size: 18px;
        margin: 10px 0;
    }
    
    h2 {
        font-size: 16px;
        margin: 20px 0 10px 0;
    }
    
    th, td {
        padding: 6px 3px;
        font-size: 11px;
    }
}

/* 非常に小さい画面対応 */
@media screen and (max-width: 480px) {
    .main {
        font-size: 65%;
    }
    
    table {
        font-size: 10px;
    }
    
    th, td {
        padding: 4px 2px;
        font-size: 10px;
    }
    
    h1 {
        font-size: 16px;
    }
    
    h2 {
        font-size: 14px;
    }
}