:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --light-gray: #f3f4f6;
    --medium-gray: #e5e7eb;
    --dark-gray: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.athlete-entry {
    display: grid;
    grid-template-columns: 300px 1fr;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.athlete-profile {
    border-right: 1px solid var(--medium-gray);
    background: white;
    text-align: left;
}

.athlete-main-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}


.athlete-main-info {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--medium-gray);
    background-color: white;
}

.athlete-rank {
    position: relative;
    background-color: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 0 0 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.rank-number {
    font-size: 28px;
    font-weight: 800;
}

.athlete-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 16px;
    border: 3px solid var(--light-gray);
    position: relative;
}

.athlete-year {
    color: var(--dark-gray);
    font-size: 14px;
    font-style: italic;
    margin-top: 4px;
}

.athlete-year::before,
.athlete-city::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.athlete-year::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236b7280"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z"/></svg>');
}

.athlete-city::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236b7280"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>');
}

.races-count {
    margin-top: 12px;
    font-size: 14px;
    align-items: center;
    gap: 8px;
    padding-bottom: 20px;
}

.races-count::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236b7280"><path d="M21 4h-3V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v1H3a1 1 0 0 0-1 1v3a4 4 0 0 0 4 4h1.192A7.037 7.037 0 0 0 11 14.803V19H8v2h8v-2h-3v-4.197A7.037 7.037 0 0 0 17.808 12H19a4 4 0 0 0 4-4V5a1 1 0 0 0-1-1zM6 10a2 2 0 0 1-2-2V6h1v3.816A3.963 3.963 0 0 1 6 10zm12 0c.392 0 .769-.057 1.126-.163l.003-.001.003-.001.001-.001V6h1v2a2 2 0 0 1-2 2z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    
}

@media (max-width: 1024px) {
    .athlete-photo {
        width: 60px;
        height: 60px;
        margin: 0 16px 0 0;
    }
}

.athlete-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.athlete-info {
    flex: 1;
    padding-left: 20px;
}

.athlete-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.athlete-name a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.athlete-name a:hover {
    color: var(--primary-color);
}

.athlete-name strong {
    font-weight: 700;
}

.athlete-year {
    color: var(--dark-gray);
    font-size: 14px;
}

.athlete-city {
    color: var(--dark-gray);
    font-size: 14px;
    font-style: italic;
    padding-bottom: 20px;
}

.athlete-events {
    background-color: var(--light-gray);
}

.event-entry-wrapper {
    padding: 12px 16px;
    border-bottom: 1px solid var(--medium-gray);
    transition: background-color 0.2s ease;
}

.event-entry-wrapper:last-child {
    border-bottom: none;
}

.event-entry-wrapper:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.event-entry {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.event-flag {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.event-country {
    font-weight: 500;
    min-width: 100px;
}

.event-year {
    color: var(--dark-gray);
    font-size: 14px;
    min-width: 50px;
}

.event-title {
    flex: 1;
    min-width: 200px;
    font-weight: 500;
}

.event-time {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

.best-time {
    background-color: var(--success-color);
    font-weight: 600;
}

.event-comment {
    margin-top: 8px;
    padding: 6px 10px;
    color: var(--error-color);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
}

@media (max-width: 1024px) {
    .athlete-entry {
        grid-template-columns: 1fr;
    }
    
    .athlete-profile {
        border-right: none;
        border-bottom: 1px solid var(--medium-gray);
    }
    
    .athlete-main-info {
        flex-direction: row;
        text-align: left;
        padding: 16px;
    }

    .athlete-rank {
        margin-bottom: 12px;
    }

    .athlete-photo {
        margin: 0 0 12px 0;
    }

    .athlete-info {
        text-align: center;
    }

    .event-entry {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .event-country::after,
    .event-year::after {
        content: "•";
        margin-left: 8px;
        color: var(--dark-gray);
    }

    .event-time {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .athlete-photo {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    .event-entry {
        gap: 4px;
    }

    .event-country::after,
    .event-year::after {
        margin-left: 4px;
    }

    .event-title {
        flex: 1 0 100%;
        margin-top: 4px;
    }
}

/* --- Styles for Stats Block --- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f3f4f6;
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
    line-height: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--dark-gray);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .stat-number {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
        min-height: 120px;
    }

    .stat-number {
        font-size: 24px;
    }
}

/* Скопированный с body набор базовых свойств — теперь только внутри блоков плагина */
.all-athletes-rating,
.athlete-entry.single-athlete {
    line-height: 1.5;
    color: var(--text-color);
}
/* Страховка от редких переполнений внутри блока плагина */
.all-athletes-rating {
    overflow-x: hidden;
}
/* УДАЛЕНО: глобальная стилизация body, вызывающая горизонтальный скролл */
/*
body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f9fafb;
    padding: 20px;
}
*/



/* Annual summary: compact equal-size tiles with debut badges. */
.ironman-year-stats { margin: 0 0 24px; padding: 16px 0; color: #1f2937; }
.ironman-year-stats .ironman-year-stats__title { margin: 0 0 6px; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.ironman-year-stats .ironman-year-stats__note,
.ironman-year-stats .ironman-year-stats__footnote { margin: 0; font-size: 0.8125rem; line-height: 1.5; color: #4b5563; }
.ironman-year-stats .ironman-year-stats__record { margin: 6px 0 0; font-size: 0.8125rem; line-height: 1.5; font-weight: 600; color: #1e40af; }
.ironman-year-stats .ironman-year-stats__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; margin: 12px 0 8px; padding: 0; font-size: 0.8125rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ironman-year-stats .ironman-year-stats__item { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; min-height: 44px; padding: 6px 6px 6px 10px; background: #f3f4f6; border-radius: 8px; }
.ironman-year-stats__item dt { margin: 0; padding: 0; font-size: inherit; font-weight: 600; }
.ironman-year-stats__item dd { display: flex; align-items: center; gap: 5px; margin: 0; padding: 0; font-size: inherit; }
.ironman-year-stats__finishes { color: #4b5563; }
.ironman-year-stats__debut { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 28px; height: 28px; padding: 0 3px; border-radius: 50%; background: #e5e7eb; color: #1f2937; font-size: 0.75rem; font-weight: 700; }
.ironman-year-stats .ironman-year-stats__item--record { background: #dbeafe; color: #1e40af; }
.ironman-year-stats__item--record .ironman-year-stats__finishes { color: #1e40af; }
.ironman-year-stats__item--record .ironman-year-stats__debut { background: #1d4ed8; color: #fff; }
.ironman-year-stats__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.ironman-year-stats .ironman-year-stats__footnote { margin-top: 6px; }


/* Athlete profile heading. The surrounding theme may style article headings. */
.single-ironman_athlete .breadcrumb,
.ironman-rating-page .breadcrumb { margin-bottom: 40px; flex-wrap: wrap; row-gap: 4px; overflow-wrap: anywhere; }
.ironman-rating-page .entry-title { margin-top: 0; }
.ironman-profile-heading { margin: 0 0 24px; }
.ironman-profile-heading .ironman-profile-title { margin: 0 0 10px; font-size: 2rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; color: var(--text-color, #1f2937); }
.ironman-profile-heading .ironman-profile-status { margin: 0 0 6px; font-size: 1.125rem; line-height: 1.45; font-weight: 600; color: #1e40af; }
.ironman-profile-heading .ironman-profile-caption { margin: 0; max-width: 70ch; font-size: 0.875rem; line-height: 1.5; color: #4b5563; }
/* Scoped fallback for WPSHOP installations overriding the standard element hooks. */
.single-ironman_athlete .entry-meta,
.single-ironman_athlete .rating-box,
.single-ironman_athlete .author-box,
.single-ironman_athlete .related-posts,
.single-ironman_athlete .entry-title { display: none; }
@media (max-width: 480px) {
    .ironman-profile-heading .ironman-profile-title { font-size: 1.625rem; }
    .ironman-profile-heading .ironman-profile-status { font-size: 1rem; }
}
