/* =========================================================
   horse.css
   競走馬ページ
   ========================================================= */

.horse-content {
    max-width: 780px;
    margin: 0 auto;
}


/* =========================================================
   馬名
   ========================================================= */

.horse-identity {
    margin-bottom: 12px;
    padding: 10px 4px 12px;
    border-bottom: 1px solid var(--color-border);
}

.horse-name {
    margin: 0;
    font-size: 2rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.horse-status-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 6px;
}

.horse-trophy {
    flex-shrink: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.horse-trophy-grade-1 {
    color: #ffd700;
}

.horse-trophy-grade-2 {
    color: #c0c0c0;
}

.horse-trophy-grade-3 {
    color: #ac6b25;
}

.horse-sex-age {
    color: var(--color-text-light);
    font-size: .95rem;
}

.horse-fatigue-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: #f2f3f4;
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: .78rem;
    line-height: 1.4;
    white-space: nowrap;
}

.horse-fatigue-icons {
    line-height: 1;
}


/* =========================================================
   シーズン選択
   ========================================================= */

.horse-season-control {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.horse-season-select {
    min-width: 132px;
    min-height: 38px;
    padding: 5px 34px 5px 12px;
    background-color: #ffffff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}

.horse-season-select:focus {
    border-color: var(--color-main);
    box-shadow: 0 0 0 3px rgba(12, 96, 64, .12);
    outline: 0;
}


/* =========================================================
   プロフィール
   ========================================================= */

.horse-profile-card {
    padding: 0;
    overflow: hidden;
}

.horse-profile-list {
    margin: 0;
}

.horse-profile-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-border);
}

.horse-profile-row:last-child {
    border-bottom: 0;
}

.horse-profile-row dt {
    font-weight: 700;
}

.horse-profile-row dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.horse-record {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 10px;
}

.horse-record-summary,
.horse-number {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.horse-record-breakdown {
    color: var(--color-text-light);
    font-size: .82rem;
    white-space: nowrap;
}

.horse-major-wins {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
}

.horse-major-wins li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.horse-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    flex-shrink: 0;
    padding: 1px 5px;
    color: #ffffff;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.5;
}

.horse-grade-1 {
    background: #2f5d8c;
}

.horse-grade-2 {
    background: #a53a3a;
}

.horse-grade-3 {
    background: #527a2b;
}


/* =========================================================
   Season成績
   ========================================================= */

.horse-season-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.horse-season-card {
    padding: 0;
    overflow: hidden;
}

.horse-season-stats {
    margin: 0;
}

.horse-season-stat {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-border);
}

.horse-season-stat:last-child {
    border-bottom: 0;
}

.horse-season-stat dt {
    font-weight: 700;
}

.horse-season-stat dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.horse-season-primary-number {
    color: var(--color-main-dark);
    font-weight: 700;
}


/* =========================================================
   Seasonレース結果
   ========================================================= */

.horse-race-history-card {
    padding: 0;
    overflow: hidden;
}

.horse-race-history {
    margin: 0;
    padding: 0;
}

.horse-race-pagination {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) auto minmax(90px, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.horse-race-page-button {
    min-width: 90px;
    min-height: 38px;
    padding: 6px 14px;
    background: #ffffff;
    color: var(--color-main-dark);
    border: 1px solid var(--color-main);
    border-radius: 6px;
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
}

.horse-race-page-button:first-child {
    justify-self: end;
}

.horse-race-page-button:last-child {
    justify-self: start;
}

.horse-race-page-button:hover:not(:disabled) {
    background: rgba(12, 96, 64, .06);
}

.horse-race-page-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(12, 96, 64, .12);
    outline: 0;
}

.horse-race-page-button:disabled {
    background: #f5f5f5;
    color: var(--color-text-light);
    border-color: var(--color-border);
    cursor: default;
    opacity: .65;
}

.horse-race-page-button[aria-busy="true"] {
    cursor: wait;
}

.horse-race-page-status {
    min-width: 54px;
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.horse-race-history-item {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.horse-race-history-item:last-child {
    border-bottom: 0;
}

.horse-race-thumbnail {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 160px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #454545;
    color: #ffffff;
    border-radius: 6px;
}

.horse-race-thumbnail:hover {
    color: #ffffff;
}

.horse-race-thumbnail-fallback {
    z-index: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.horse-race-thumbnail-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.horse-race-thumbnail-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    color: rgba(255, 255, 255, .92);
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .65));
    transform: translate(-50%, -50%);
}

.horse-race-information {
    min-width: 0;
}

.horse-race-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    min-width: 0;
}

.horse-race-name {
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.horse-race-name:hover {
    text-decoration: underline;
}

.horse-race-meta,
.horse-race-result {
    margin: 3px 0 0;
    line-height: 1.4;
}

.horse-race-meta {
    color: var(--color-text-light);
    font-size: .82rem;
}

.horse-race-result {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: .85rem;
}

.horse-race-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 24px;
    flex-shrink: 0;
    padding: 1px 4px;
    background: #f5f5f5;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.horse-race-rank-1 {
    background: #ffd700;
    color: #ffffff;
    border-color: #ffd700;
}

.horse-race-rank-2 {
    background: #c0c0c0;
    color: #ffffff;
    border-color: #c0c0c0;
}

.horse-race-rank-3 {
    background: #ac6b25;
    color: #ffffff;
    border-color: #ac6b25;
}


/* =========================================================
   レスポンシブ
   ========================================================= */

@media (max-width: 767.98px) {
    .horse-identity {
        padding: 6px 2px 10px;
    }

    .horse-name {
        font-size: 1.55rem;
    }

    .horse-status-row {
        gap: 6px 10px;
        margin-top: 4px;
    }

    .horse-trophy {
        font-size: 1.1rem;
    }

    .horse-sex-age {
        font-size: .88rem;
    }

    .horse-fatigue-status {
        padding: 2px 7px;
        font-size: .74rem;
    }

    .horse-season-select {
        min-width: 124px;
        min-height: 36px;
        font-size: .85rem;
    }

    .horse-profile-row {
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 10px;
        padding: 10px 12px;
        font-size: .9rem;
    }

    .horse-major-wins {
        gap: 6px;
    }

    .horse-major-wins li {
        gap: 6px;
    }

    .horse-season-header {
        gap: 8px;
    }

    .horse-season-header .section-title {
        font-size: 1.1rem;
    }

    .horse-season-stat {
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 10px;
        padding: 10px 12px;
        font-size: .9rem;
    }

    .horse-race-history-item {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .horse-race-thumbnail {
        width: 112px;
    }

    .horse-race-thumbnail-play {
        font-size: 1.45rem;
    }

    .horse-race-title-row {
        gap: 3px 5px;
    }

    .horse-race-name {
        font-size: .9rem;
    }

    .horse-race-meta {
        font-size: .72rem;
    }

    .horse-race-result {
        gap: 3px 6px;
        font-size: .76rem;
    }

    .horse-race-rank {
        min-width: 26px;
        min-height: 22px;
        font-size: .72rem;
    }

    .horse-race-pagination {
        grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr);
        gap: 8px;
    }

    .horse-race-page-button {
        min-width: 80px;
        min-height: 36px;
        padding: 5px 10px;
        font-size: .78rem;
    }

    .horse-race-page-status {
        min-width: 48px;
        font-size: .78rem;
    }
}

@media (max-width: 359.98px) {
    .horse-race-history-item {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 8px;
        padding: 9px 8px;
    }

    .horse-race-thumbnail {
        width: 88px;
    }

    .horse-race-meta {
        font-size: .68rem;
    }
}
