/* Base tokens */
:root {
    --bg: #ffffff;
    --bg-muted: #f6f7f9;
    --text: #1a1d21;
    --text-muted: #5b6470;
    --text-quiet: #98a1ac;
    --border: #e1e5ea;
    --accent: #1a5c8a;
    --accent-dark: #144767;
    --radius: 4px;
    --container: 1080px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin: 0;
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-dark);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 20px;
    top: 12px;
    z-index: 10;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}

/* Header and navigation */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand-mark {
    width: 6px;
    height: 22px;
    background: var(--accent);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-left: auto;
}

.current-season {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link {
    display: inline-block;
    padding: 6px 10px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.95rem;
    text-decoration: none;
}

a.nav-link:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.nav-link.is-active {
    color: var(--accent);
    font-weight: 600;
}

.nav-link.is-disabled {
    color: var(--text-quiet);
    cursor: default;
}

/* Main content */
.site-main {
    padding: 32px 0 56px;
}

.hero {
    padding: 36px 28px;
    margin-bottom: 40px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.hero-title {
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.hero-lead {
    max-width: 60ch;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.hero-data-note {
    max-width: 75ch;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.section {
    margin-bottom: 44px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    padding-bottom: 10px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-note {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tournament-parent-link {
    margin-top: 8px;
}

.tournament-parent-link a {
    color: var(--text-muted);
    text-decoration: none;
}

.tournament-parent-link a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.season-group + .season-group {
    margin-top: 32px;
}

.season-group-title {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-muted);
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

a.card {
    color: inherit;
    text-decoration: none;
}

a.card:hover {
    border-color: var(--accent);
}

.card-title {
    font-size: 1rem;
}

.card-text {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.competition-card-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.competition-list-mobile {
    display: none;
}

.competition-list-desktop {
    display: block;
}

.competition-table .tag {
    display: inline-block;
    margin: 2px 4px 2px 0;
    white-space: nowrap;
}

.competition-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.competition-panel:hover,
.competition-panel:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 12%, transparent);
}

.competition-panel-name {
    font-size: 1rem;
    line-height: 1.35;
}

.competition-panel-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.competition-panel-categories .tag {
    margin: 0;
    text-transform: none;
}

.ranking-list-table .tag {
    text-transform: none;
}

.competition-panel-no-categories {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.competition-panel-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.competition-panel-location {
    min-width: 0;
    overflow-wrap: anywhere;
}

.competition-panel-meta time {
    flex: none;
    text-align: right;
}

.external-link-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tournament-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.tournament-card-age-range {
    flex: none;
    margin-top: 0;
}

.tournament-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.tournament-results-tag {
    margin-left: auto;
}

.tournament-card-start {
    margin-left: auto;
    text-align: right;
}

.tag {
    align-self: flex-start;
    margin-top: auto;
    padding: 2px 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.competition-tournaments-mobile {
    display: none;
}

.competition-tournament-category {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.competition-tournament-category .tag {
    margin-top: 0;
    white-space: nowrap;
    text-transform: none;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.tournament-results-table th,
.tournament-results-table td {
    padding-top: 4px;
    padding-bottom: 4px;
}

.tournament-results-table tbody td {
    vertical-align: middle;
}

.tournament-result-cell-content {
    display: flex;
    align-items: center;
    min-height: 27px;
    line-height: 27px;
}

.tournament-results-table td.num .tournament-result-cell-content {
    justify-content: flex-end;
}

.tournament-results-athlete-content {
    flex-wrap: wrap;
    gap: 0 4px;
}

.tournament-results-athlete-name {
    min-width: 0;
    flex: 0 1 auto;
}

.table thead th {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--bg-muted);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.competition-season,
.competition-date {
    width: 1%;
    white-space: nowrap;
    font-size: 0.82rem;
}


/* Buttons */
.button {
    display: inline-block;
    padding: 8px 16px;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.95rem;
    text-decoration: none;
}

.button:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.button-secondary {
    background: var(--bg);
    color: var(--accent);
}

.button-secondary:hover {
    background: var(--bg-muted);
    color: var(--accent-dark);
}

.empty-state {
    padding: 28px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
}

/* Ranking page */
.page-title {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.notice {
    padding: 12px 16px;
    margin-bottom: 32px;
    background: #fff8e1;
    border: 1px solid #e0c36a;
    border-radius: var(--radius);
}

.podium-position {
    color: var(--accent);
}

/* Podium: one column per place; athletes who share a place are stacked vertically. */
.podium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    align-items: start;
}

.podium-place {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Shared podium card used by rankings and tournament results. */
.podium-card {
    height: 96px;
    padding: 8px 12px;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
}

.podium-medal {
    flex: none;
    width: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Award artwork is provided as optimized raster images (preferably WebP). */
.medal {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
}

/* Places 5-8 use the blue rosette; keep it slightly smaller than podium trophies. */
.medal-top8 {
    width: 58px;
    height: 58px;
}

.podium-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow-wrap: break-word;
}

.podium-points {
    margin-top: auto;
    font-weight: 600;
    line-height: 1.3;
}

.ranking-table .result-head,
.ranking-table .result {
    text-align: center;
}

.result {
    white-space: nowrap;
}

.result span {
    display: block;
}

/* Result status: counted green, rejected red, replaced black struck through. */
.is-counted {
    color: #1e7a34;
}

.is-rejected {
    color: #b3261e;
}

.is-replaced {
    color: var(--text);
    text-decoration: line-through;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 0;
    margin: 16px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    list-style: none;
}

.legend .result {
    display: inline-block;
    margin-right: 6px;
}

.ranking-list-legend {
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* A wide page (header, content and footer): the ranking table needs room for about 15
   tournament columns next to the athlete columns without scrolling sideways. */
.wide-page .container {
    max-width: 1440px;
}

/* Dense layout: the ranking table comes right after the podium and its rows are low, so
   that about 15 rows fit on a desktop screen without scrolling. */
.ranking-page .section {
    margin-bottom: 20px;
}

.ranking-page .section-head {
    margin-bottom: 10px;
}

.ranking-page .notice {
    margin-bottom: 16px;
}

.section-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
}

.ranking-resource-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.ranking-difference-link {
    display: inline-block;
    padding: 5px 10px;
    background: #fffafa;
    border: 1px solid #ead1cf;
    border-radius: var(--radius);
    color: #963f3a;
    font-weight: 600;
    text-decoration: none;
}

.ranking-difference-link:hover {
    background: #fff1f0;
    border-color: #d9b5b2;
    color: #7f302c;
}

.ranking-high-severity-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    color: #9a463e;
    vertical-align: -3px;
    user-select: none;
}

.ranking-high-severity-icon svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.ranking-high-severity-icon path:first-child {
    fill: #fff4f2;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linejoin: round;
}

.ranking-high-severity-icon path:last-child {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
}

.ranking-differences-page .section-head {
    align-items: center;
}

.ranking-differences-back {
    flex: 0 0 auto;
}

.ranking-severity-note {
    padding: 14px 18px;
    margin-bottom: 28px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.ranking-severity-note ul {
    display: grid;
    gap: 4px;
    padding-left: 20px;
    margin: 8px 0 0;
}

.ranking-severity-note strong {
    color: var(--text);
}

.ranking-severity-group {
    margin-top: 28px;
}

.ranking-severity-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ranking-severity-label {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.ranking-severity-high {
    background: #fff4f2;
    border-color: #e8c9c4;
    color: #8b4038;
}

.ranking-severity-medium {
    background: #fff9ec;
    border-color: #eadcb9;
    color: #78602c;
}

.ranking-severity-low {
    background: #f2f7f5;
    border-color: #d1e1da;
    color: #416556;
}

.ranking-severity-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ranking-difference-list {
    display: grid;
    gap: 10px;
}

.ranking-difference-card {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-wrap: anywhere;
}

.ranking-difference-athlete {
    margin-bottom: 3px;
    font-size: 1rem;
}

.ranking-difference-athlete-club {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ranking-difference-reason {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.ranking-difference-detail,
.ranking-difference-comment,
.ranking-difference-origin {
    margin-top: 5px;
    font-size: 0.92rem;
}

.ranking-difference-detail > span,
.ranking-difference-origin {
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .ranking-differences-page .section-head {
        align-items: flex-start;
    }

    .ranking-difference-card {
        padding: 12px;
    }

    .ranking-severity-note {
        padding: 12px;
    }
}

/* Official / unofficial switch: two plain links, the current one is highlighted. */
.variant-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.variant-switch a,
.variant-switch .variant-current {
    padding: 3px 12px;
    text-decoration: none;
}

.variant-switch a {
    background: var(--bg-muted);
    color: var(--text-muted);
}

.variant-switch a:hover {
    background: var(--bg);
    color: var(--accent);
}

.variant-switch .variant-current {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.variant-switch a + .variant-current,
.variant-switch .variant-current + a {
    border-left: 1px solid var(--border);
}

.list-links {
    white-space: nowrap;
}


/* Competition list controls: one checkbox per tournament plus a master checkbox. */
.competition-column-toggle {
    width: 1%;
    padding-left: 4px !important;
    padding-right: 4px !important;
    text-align: center !important;
    white-space: nowrap;
}

.competition-column-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
}

/* "Hide rejected results": the rejected (red) results disappear, the cell stays as an empty one. */
.hide-rejected-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}

/* "display" above would otherwise beat the hidden attribute (shown by the script). */
.hide-rejected-toggle[hidden] {
    display: none;
}

.hide-rejected-toggle input {
    margin: 0 4px 0 0;
    vertical-align: middle;
}

.ranking-table.hide-rejected .is-rejected span {
    display: none;
}

.ranking-table.hide-rejected .is-rejected::after {
    content: "\2014";
    color: var(--text);
}

.list-links a + a {
    margin-left: 16px;
}

/* Names and clubs may use up to two lines; points stay at the bottom on ranking cards. */
.podium-card .card-title,
.podium-card .card-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.podium-card .card-title {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.25;
}

.podium-card .card-text {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 0.8rem;
    line-height: 1.25;
}

.ranking-table,
.competitions-table {
    font-size: 0.9rem;
    line-height: 1.25;
}

.ranking-table th,
.ranking-table td,
.competitions-table th,
.competitions-table td {
    padding: 3px 8px;
}

.ranking-table thead th,
.competitions-table thead th {
    padding-top: 6px;
    padding-bottom: 6px;
}

.competition-mobile-card {
    display: none;
}

.competition-list-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    cursor: pointer;
}

.competition-list-count {
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.competition-list-toggle-label {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ranking-table .result {
    padding: 1px 6px;
    font-size: 0.78rem;
    line-height: 1.1;
}

/* Footer */
.site-footer {
    padding: 24px 0;
    background: var(--bg-muted);
    border-top: 1px solid var(--border);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    .competition-list-mobile {
        display: flex;
    }

    .competition-list-desktop {
        display: none;
    }

    .competition-tournaments-desktop {
        display: none;
    }

    .competition-tournaments-mobile {
        display: grid;
    }

    .site-header-inner {
        align-items: flex-start;
    }

    .site-nav {
        width: 100%;
        margin-left: 0;
    }

    .site-main {
        padding: 24px 0 40px;
    }

    .hero {
        padding: 26px 20px;
        margin-bottom: 32px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .competitions-table {
        width: 100%;
        table-layout: fixed;
    }

    .competitions-table thead th:nth-child(n + 2),
    .competitions-table tbody td:nth-child(2),
    .competitions-table tbody td:nth-child(4),
    .competitions-table tbody td:nth-child(5) {
        display: none;
    }

    .competitions-table .competition-column-toggle {
        width: 34px;
        min-width: 34px;
        padding: 8px 5px !important;
    }

    .competitions-table tbody td:nth-child(3) {
        padding: 5px 8px;
        border: 0;
    }

    .competition-desktop-name {
        display: none;
    }

    .competition-desktop-name.competition-mobile-heading {
        display: none;
    }

    .competition-mobile-card {
        display: grid;
        gap: 4px;
        min-width: 0;
        padding: 9px 11px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--bg-muted);
    }

    .competition-mobile-heading {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px 8px;
        min-width: 0;
    }

    .competition-mobile-name {
        flex: 1 1 auto;
        min-width: 0;
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .competition-mobile-meta {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        gap: 3px 8px;
        color: var(--text-muted);
        font-size: 0.78rem;
        line-height: 1.25;
    }

    .competition-mobile-location {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .competition-mobile-meta time {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
        white-space: nowrap;
    }

    .competition-mobile-meta .tag {
        grid-column: 1 / -1;
        margin: 0;
        padding: 1px 5px;
        font-size: 0.68rem;
    }

    .competition-list-disclosure > summary {
        margin-bottom: 0;
        padding: 8px 0;
    }

    .competition-list-disclosure[open] > summary {
        margin-bottom: 8px;
    }

    /* The first five columns fill the phone viewport; tournament results start
       beyond its right edge and remain available by horizontal scrolling. */
    .ranking-page .table-wrap {
        margin-left: -8px;
        margin-right: -8px;
    }

    .ranking-table {
        width: max-content;
        table-layout: fixed;
        font-size: 0.72rem;
        line-height: 1.1;
    }

    .ranking-table th,
    .ranking-table td {
        padding-left: 3px;
        padding-right: 3px;
    }

    .ranking-table .rank-position {
        width: 30px;
        min-width: 30px;
        max-width: 30px;
    }

    .ranking-table .rank-athlete {
        width: calc(100vw - 311px);
        min-width: 48px;
        max-width: none;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .ranking-cell-text {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow-wrap: normal;
    }

    .ranking-table .rank-birth {
        width: 62px;
        min-width: 62px;
        max-width: 62px;
        white-space: nowrap;
        text-align: center;
    }

    .ranking-table .rank-club {
        width: 145px;
        min-width: 145px;
        max-width: 145px;
        padding-left: 8px;
        white-space: normal;
    }

    .ranking-table .rank-total {
        width: 58px;
        min-width: 58px;
        max-width: 58px;
    }

    .ranking-table .result-head,
    .ranking-table .result {
        min-width: 46px;
    }

    .ranking-table .result {
        padding-left: 3px;
        padding-right: 3px;
        font-size: 0.7rem;
    }

    @media (max-width: 380px) {
        .ranking-table .rank-position {
            width: 26px;
            min-width: 26px;
            max-width: 26px;
        }

        .ranking-table .rank-athlete {
            width: calc(100vw - 266px);
            min-width: 48px;
        }

        .ranking-table .rank-birth {
            width: 56px;
            min-width: 56px;
            max-width: 56px;
        }

        .ranking-table .rank-club {
            width: 118px;
            min-width: 118px;
            max-width: 118px;
        }

        .ranking-table .rank-total {
            width: 50px;
            min-width: 50px;
            max-width: 50px;
        }
    }

}

.nav-back {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.nav-back:hover {
    text-decoration: underline;
}

.nav-back[hidden] {
    display: none;
}

/* Compact athlete pages use the public section, switch and award components above. */
.athlete-profile .section-head {
    margin-bottom: 8px;
}

.athlete-heading {
    display: grid;
    justify-items: start;
    gap: 4px;
}

.athlete-category-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.athlete-season {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.athlete-season .section-head {
    margin-bottom: 12px;
}

.athlete-trophies {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.athlete-trophy {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 2px;
    min-width: 0;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.25;
}

.athlete-trophy .medal {
    width: 44px;
    height: 44px;
}

.athlete-trophy .medal-top8 {
    width: 40px;
    height: 40px;
}

.athlete-trophy strong {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.athlete-ranking {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding-top: 10px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
}

.athlete-ranking-list {
    list-style-type: none;
}

.athlete-ranking-list > li::marker {
    content: "";
}

.athlete-results-link {
    margin: 20px 0 0;
}

.athlete-results-page .section-head {
    align-items: center;
}

.athlete-results-page .variant-switch {
    margin-top: 12px;
}

.athlete-result-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.athlete-result {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 16px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
}

.athlete-result:first-child {
    border-top: 1px solid var(--border);
}

.athlete-result-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.athlete-result-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.athlete-results-table th:nth-child(1),
.athlete-results-table td:nth-child(1),
.athlete-results-table th:nth-child(2),
.athlete-results-table td:nth-child(2),
.athlete-results-table th:nth-child(3),
.athlete-results-table td:nth-child(3) {
    width: 1%;
    white-space: nowrap;
}

.athlete-results-table td.athlete-result-medal {
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
}

.athlete-result-medal .medal {
    width: 28px;
    height: 28px;
}

.athlete-result-medal .medal-top8 {
    width: 25px;
    height: 25px;
}

@media (max-width: 480px) {
    .athlete-season {
        padding: 12px;
    }

    .athlete-trophies {
        gap: 4px;
    }

    .athlete-trophy {
        font-size: 0.72rem;
    }

    .athlete-trophy .medal {
        width: 38px;
        height: 38px;
    }

    .athlete-result {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 2px 8px;
    }

    .athlete-result-date {
        grid-column: 1 / -1;
    }
}

.athlete-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.athlete-filter-form label {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.athlete-filter-form input,
.athlete-filter-form select {
    min-height: 38px;
    padding: 6px 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}

.athlete-filter-search {
    flex: 1 1 250px;
    min-width: min(100%, 220px);
}

.athlete-filter-search input,
.athlete-filter-control select,
.athlete-filter-control input {
    width: 100%;
}

.athlete-filter-control {
    flex: 0 1 180px;
    min-width: 140px;
}

.competition-date-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 300px;
    gap: 10px 12px;
    min-width: 0;
}

.competition-date-filters .athlete-filter-control {
    min-width: 0;
}

.competition-date-filters input[type="date"] {
    box-sizing: border-box;
    min-width: 0;
    padding-right: 4px;
    padding-left: 4px;
}

.competition-category-filter {
    flex-basis: 220px;
}

.competition-filter-label {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.competition-category-picker {
    position: relative;
}

.competition-category-picker[open] {
    z-index: 2;
}

.competition-category-picker > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: 6px 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

.competition-category-picker > summary::-webkit-details-marker {
    display: none;
}

.competition-category-picker > summary::after {
    content: "▾";
    margin-left: 8px;
    color: var(--text-muted);
}

.competition-category-picker[open] > summary::after {
    content: "▴";
}

.competition-category-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 3;
    width: max(100%, 250px);
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgb(0 0 0 / 12%);
}

.competition-category-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    margin-bottom: 0;
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
}

.competition-category-options label:hover {
    background: var(--bg-muted);
}

.competition-category-options input[type="checkbox"] {
    flex: none;
    width: auto;
    min-height: 0;
    padding: 0;
}

.athlete-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.athlete-filter-actions .button {
    font: inherit;
    cursor: pointer;
}

.athlete-result-count {
    margin-bottom: 8px;
}

.athlete-table {
    table-layout: fixed;
}

.athlete-cards {
    display: none;
}

.athlete-table th:nth-child(1),
.athlete-table td:nth-child(1),
.athlete-table th:nth-child(2),
.athlete-table td:nth-child(2) {
    width: 25%;
}

.athlete-table th:nth-child(3),
.athlete-table td:nth-child(3) {
    width: 50%;
    overflow-wrap: anywhere;
}

.athlete-table th.is-sorted {
    background: var(--bg-muted);
}

.competition-table th.is-sorted {
    background: var(--bg-muted);
}

.athlete-table th a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
    text-decoration: none;
}

.competition-table th a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
    text-decoration: none;
}

.athlete-table th a:hover {
    color: var(--accent);
}

.competition-table th a:hover {
    color: var(--accent);
}

.athlete-sort-indicator {
    color: var(--text-quiet);
    font-size: 0.8rem;
}

.athlete-table th.is-sorted .athlete-sort-indicator {
    color: var(--accent);
}

.competition-table th.is-sorted .athlete-sort-indicator {
    color: var(--accent);
}

.athlete-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    margin-top: 16px;
}

.athlete-pagination .button {
    padding: 5px 10px;
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .competition-category-filter {
        flex-basis: 100%;
    }

    .athlete-filter-search {
        flex-basis: 100%;
    }

    .competition-date-filters {
        flex: 1 1 100%;
        width: 100%;
    }

    .athlete-filter-control {
        flex: 1 1 120px;
        min-width: 0;
    }

    .athlete-filter-actions {
        width: 100%;
    }

    .athlete-directory .table-wrap {
        display: none;
    }

    .athlete-cards {
        display: grid;
        gap: 8px;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .athlete-card {
        display: grid;
        gap: 3px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    .athlete-card-name {
        font-weight: 600;
        text-decoration: none;
    }

    .athlete-card-club {
        color: var(--text-muted);
        font-size: 0.9rem;
    }

    .athlete-table th,
    .athlete-table td {
        padding: 8px 6px;
        overflow-wrap: anywhere;
    }
}

