/* 比較テーブル */
.comparison-table-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 30px;
    margin-bottom: 30px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    box-sizing: border-box;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto 40px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    table-layout: auto;
}

.comparison-table thead {
    background: #B8CFD3;
    color: #fff;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

/* 各列の幅をパーセンテージで設定（画面幅に応じて調整） */
.comparison-table th:nth-child(1),
.comparison-table td:nth-child(1) {
    width: 5%;
}

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2) {
    width: 12%;
    min-width: 120px;
}

.comparison-table th:nth-child(3),
.comparison-table td:nth-child(3) {
    width: 10%;
}

.comparison-table th:nth-child(4),
.comparison-table td:nth-child(4) {
    width: 8%;
}

.comparison-table th:nth-child(5),
.comparison-table td:nth-child(5) {
    width: 8%;
}

.comparison-table th:nth-child(6),
.comparison-table td:nth-child(6) {
    width: 10%;
}

.comparison-table th:nth-child(7),
.comparison-table td:nth-child(7) {
    width: 10%;
}

.comparison-table th:nth-child(8),
.comparison-table td:nth-child(8) {
    width: 37%;
    min-width: 250px;
}

/* レスポンシブ対応 */
@media (max-width: 928px) {
    .comparison-table-wrapper {
        overflow-x: visible;
        width: 100%;
    }

    .comparison-table {
        font-size: 14px;
        width: 100%;
        table-layout: auto;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 6px 3px;
        white-space: normal;
        word-wrap: break-word;
        vertical-align: top;
    }

    .comparison-table th:nth-child(1),
    .comparison-table td:nth-child(1) {
        width: 5%;
        min-width: 40px;
    }

    .comparison-table th:nth-child(2),
    .comparison-table td:nth-child(2) {
        width: 12%;
        min-width: 80px;
    }

    .comparison-table th:nth-child(3),
    .comparison-table td:nth-child(3) {
        width: 10%;
        min-width: 70px;
    }

    .comparison-table th:nth-child(4),
    .comparison-table td:nth-child(4) {
        width: 8%;
        min-width: 50px;
    }

    .comparison-table th:nth-child(5),
    .comparison-table td:nth-child(5) {
        width: 8%;
        min-width: 60px;
    }

    .comparison-table th:nth-child(6),
    .comparison-table td:nth-child(6) {
        width: 10%;
        min-width: 70px;
    }

    .comparison-table th:nth-child(7),
    .comparison-table td:nth-child(7) {
        width: 10%;
        min-width: 70px;
    }

    .comparison-table th:nth-child(8),
    .comparison-table td:nth-child(8) {
        width: 37%;
        min-width: 150px;
    }

    .comparison-table .btn-official {
        font-size: 12px;
        padding: 3px 6px;
        white-space: nowrap;
    }

    .comparison-table .table-image {
        width: 40px;
        height: 40px;
    }

    .comparison-table .rank-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

}

/* 700px以下で横スクロールを有効化 - 独立したメディアクエリ */
@media (max-width: 700px) {
    .comparison-table-wrapper {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 !important;
        margin-top: 30px !important;
        margin-bottom: 30px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: flex-start !important;
    }

    .comparison-table {
        min-width: 800px !important;
        width: max-content !important;
        margin: 0 !important;
        border-left: none !important;
        font-size: 14px !important;
    }
    
    .comparison-table .btn-official {
        font-size: 14px !important;
    }
    
    .comparison-table .rank-number {
        font-size: 14px !important;
    }
    
    .comparison-table-wrapper .comparison-table td:nth-child(8),
    .comparison-table td:nth-child(8),
    .comparison-table-wrapper .comparison-table td:nth-child(8) .point-editor,
    .comparison-table td:nth-child(8) .point-editor,
    .comparison-table-wrapper .comparison-table td:nth-child(8) div,
    .comparison-table td:nth-child(8) div,
    .comparison-table-wrapper .comparison-table td:nth-child(8) p,
    .comparison-table td:nth-child(8) p,
    .comparison-table-wrapper .comparison-table td:nth-child(8) span,
    .comparison-table td:nth-child(8) span {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* 順位列を左端に固定 */
    .comparison-table-wrapper .comparison-table thead th:nth-child(1),
    .comparison-table-wrapper .comparison-table tbody tr td:nth-child(1),
    .comparison-table thead th:nth-child(1),
    .comparison-table tbody tr td:nth-child(1),
    .comparison-table thead th:first-child,
    .comparison-table tbody td:first-child,
    table.comparison-table thead th:nth-child(1),
    table.comparison-table tbody tr td:nth-child(1),
    table.comparison-table thead th:first-child,
    table.comparison-table tbody td:first-child {
        position: sticky !important;
        left: 0 !important;
        z-index: 100 !important;
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        /* 背景色はrender.phpとsrc/index.jsで動的に設定される */
        box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important;
    }

    .comparison-table-wrapper .comparison-table thead th:nth-child(1),
    .comparison-table thead th:nth-child(1),
    .comparison-table thead th:first-child,
    table.comparison-table thead th:nth-child(1),
    table.comparison-table thead th:first-child {
        /* 背景色はrender.phpとsrc/index.jsで動的に設定される */
    }

    .comparison-table-wrapper .comparison-table tbody tr td:nth-child(1),
    .comparison-table tbody tr td:nth-child(1),
    .comparison-table tbody td:first-child,
    table.comparison-table tbody tr td:nth-child(1),
    table.comparison-table tbody td:first-child {
        background: #fff !important;
    }

    .comparison-table-wrapper .comparison-table tbody tr:nth-child(even) td:nth-child(1),
    .comparison-table tbody tr:nth-child(even) td:nth-child(1),
    .comparison-table tbody tr:nth-child(even) td:first-child,
    table.comparison-table tbody tr:nth-child(even) td:nth-child(1),
    table.comparison-table tbody tr:nth-child(even) td:first-child {
        background: #f9f9f9 !important;
    }

    .comparison-table th:nth-child(2),
    .comparison-table td:nth-child(2),
    .comparison-table th:nth-child(3),
    .comparison-table td:nth-child(3),
    .comparison-table th:nth-child(4),
    .comparison-table td:nth-child(4),
    .comparison-table th:nth-child(5),
    .comparison-table td:nth-child(5),
    .comparison-table th:nth-child(6),
    .comparison-table td:nth-child(6),
    .comparison-table th:nth-child(7),
    .comparison-table td:nth-child(7),
    .comparison-table th:nth-child(8),
    .comparison-table td:nth-child(8) {
        width: auto !important;
    }

    .comparison-table th:nth-child(2),
    .comparison-table td:nth-child(2) {
        min-width: 120px;
    }

    .comparison-table th:nth-child(8),
    .comparison-table td:nth-child(8) {
        min-width: 250px;
    }
}

.comparison-table td:first-child {
    text-align: center;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #B8C4C7;
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
}

.rank-number.rank-1 {
    background: #7A9A9E;
}

.rank-number.rank-2 {
    background: #8FA8AC;
}

.rank-number.rank-3 {
    background: #A4B6BA;
}

.comparison-table th {
    font-weight: bold;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.comparison-table td {
    text-align: center;
    vertical-align: middle;
}

.comparison-table th:nth-child(4),
.comparison-table td:nth-child(4) {
    text-align: center;
}

.comparison-table td:nth-child(4) .table-image {
    margin: 0 auto;
}

.comparison-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.comparison-table tbody tr {
    transition: background-color 0.2s ease;
}

.comparison-table tbody tr:hover {
    background: #f0f9f8 !important;
}

.table-image {
    width: 60px;
    height: 60px;
    background: #e0e0e0;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    overflow: hidden;
}

.table-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rating-display {
    font-weight: 600;
    color: #FF9A3D;
    margin-right: 4px;
}

.stars-display {
    display: inline-block;
    font-size: 14px;
    letter-spacing: 1px;
}

.star-filled {
    color: #FFB84D;
}

.star-half {
    color: #FFB84D;
    opacity: 0.5;
}

.star-light {
    color: #FFB84D;
    opacity: 0.7;
}

.star-outline {
    color: #FFB84D;
    opacity: 0.5;
}

.comparison-table .btn-official {
    position: static;
    background: #4CAF50;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    box-shadow: none;
    margin: 0;
    border: none;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    line-height: 1.4;
    width: auto;
    height: auto;
    white-space: nowrap;
    text-decoration: none;
    color: #fff;
}

.comparison-table .btn-official:hover {
    text-decoration: none;
}

.comparison-table .btn-official:hover {
    background: #45a049;
    transform: none;
}

