﻿:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --panel-strong: #f8fafc;
    --line: #e1e6ee;
    --text: #101828;
    --muted: #667085;
    --primary: #155eef;
    --primary-soft: #eef4ff;
    --success: #14804a;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fff6ed;
    --danger: #b42318;
    --danger-soft: #fef3f2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Prompt', sans-serif;
    color: var(--text);
    background: var(--bg);
}

.results-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0;
}

.scoreboard {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.08);
}

.board-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 32px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.event-kicker {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4.5vw, 4.2rem);
    line-height: 1;
}

.header-index {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.header-name {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.event-meta {
    display: grid;
    gap: 6px;
    min-width: 180px;
    text-align: right;
    color: var(--muted);
}

    .event-meta strong {
        color: var(--text);
        font-size: 1.25rem;
    }

.distance-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 32px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.tab-button {
    flex: 0 0 auto;
    min-width: 82px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    background: #ffffff;
    cursor: pointer;
}

    .tab-button:hover {
        color: var(--text);
        border-color: #b9c3d3;
        background: var(--panel-strong);
    }

    .tab-button.active {
        color: #ffffff;
        border-color: var(--primary);
        background: var(--primary);
    }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--line);
}

    .summary-grid article {
        padding: 20px 32px;
        border-right: 1px solid var(--line);
        background: var(--panel-strong);
        text-align: center;
    }

        .summary-grid article:last-child {
            border-right: 0;
        }

    .summary-grid span {
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: 0.82rem;
    }

    .summary-grid strong {
        font-size: 1.35rem;
    }

.action-bar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 32px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.search-box {
    display: grid;
    gap: 7px;
    width: min(520px, 100%);
}

    .search-box span {
        color: var(--muted);
        font-size: 0.82rem;
        font-weight: 800;
    }

    .search-box input {
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        color: var(--text);
        font: inherit;
        font-weight: 600;
        background: var(--panel-strong);
        outline: none;
    }

        .search-box input:focus {
            border-color: var(--primary);
            background: #ffffff;
            box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.10);
        }

.action-buttons {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.ghost-button,
.print-button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.ghost-button {
    color: var(--text);
    background: #ffffff;
}

.print-button {
    color: #ffffff;
    border-color: var(--primary);
    background: var(--primary);
}

.overview-panel,
.results-panel {
    display: none;
}

    .overview-panel.active,
    .results-panel.active {
        display: block;
    }

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 32px 18px;
}

    .section-heading span {
        color: var(--primary);
        font-size: 0.82rem;
        font-weight: 800;
    }

    .section-heading h2 {
        margin: 0;
        font-size: clamp(1.35rem, 3vw, 2rem);
    }

.podium-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 0 32px 32px;
}

.podium-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.podium-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-strong);
}

    .podium-card-head span {
        display: inline-grid;
        place-items: center;
        min-width: 48px;
        min-height: 36px;
        padding: 4px 10px;
        border-radius: 8px;
        color: #ffffff;
        font-weight: 900;
        background: var(--text);
    }

    .podium-card-head strong {
        color: var(--muted);
        font-size: 0.86rem;
    }

.podium-card ol {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.podium-card li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

    .podium-card li:first-child {
        border-top: 0;
    }

.mini-rank {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 900;
    background: var(--primary-soft);
}

.podium-card li:first-child .mini-rank {
    color: #ffffff;
    background: var(--primary);
}

.podium-card li div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.podium-card li strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-card li span:last-child {
    color: #101828;
    font-size: 0.80rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th {
    padding: 16px 22px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
    background: #f2f4f7;
}

td {
    padding: 18px 22px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f9fbfd;
}

.winner {
    background: var(--primary-soft);
}

.rank {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
    background: var(--panel-strong);
}

.winner .rank {
    color: #ffffff;
    border-color: var(--primary);
    background: var(--primary);
}

.bib {
    display: inline-flex;
    align-items: center;
    min-width: 82px;
    padding: 7px 10px;
    border-left: 3px solid var(--primary);
    font-weight: 900;
    background: var(--primary-soft);
}

.bib-link,
.podium-link {
    color: inherit;
    text-decoration: none;
}

    .bib-link:hover .bib,
    .podium-link:hover {
        text-decoration: underline;
    }

.runner {
    display: grid;
    gap: 3px;
}

    .runner span {
        color: var(--muted);
        font-size: 0.82rem;
    }

.station {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 85px;
    padding: 5px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.80rem !important;
    font-weight: 800;
    background: #ffffff;
}

    .station.active {
        color: var(--warning);
        border-color: #fedf89;
        background: var(--warning-soft);
    }

    .station.done {
        color: var(--success);
        border-color: #abefc6;
        background: var(--success-soft);
    }

    .station.dnf {
        color: #b42318;
        border-color: #fecdca;
        background: #fff1f0;
    }

.sort-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
}

.female-row td {
    background: #ffe4ec;
}

.female-row:hover td {
    background: #ffe4ec;
}

.dnf-row td {
    background: #ffe7e5;
}

.dnf-row:hover td {
    background: #ffe4ec;
}

.sex-icon {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

    .sex-icon.male {
        color: #175cd3;
        background: #eff8ff;
    }

    .sex-icon.female {
        color: #c11574;
        background: #fdf2fa;
    }

    .sex-icon.unknown {
        color: var(--muted);
        background: #f2f4f7;
    }

.time {
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

.empty-state,
.error-state {
    display: none;
    margin: 0;
    padding: 30px 32px 38px;
    color: var(--muted);
    text-align: center;
    font-weight: 800;
}

    .error-state.active {
        display: block;
        color: var(--danger);
        background: var(--danger-soft);
    }

    .empty-state.active {
        display: block;
    }

.detail-shell {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0;
}

.detail-header {
    align-items: center;
}

.detail-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f7faff 52%, #fdf2fa 100%);
}

.detail-title-block {
    display: grid;
    gap: 10px;
}

.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.detail-bib-badge,
.detail-distance-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.92);
}

.detail-bib-badge {
    color: var(--primary);
    border-color: #bfd2ff;
    background: #eff4ff;
}

.detail-distance-badge {
    color: #8a1c63;
    border-color: #f3c6dd;
    background: #fff1f8;
}

.detail-side {
    gap: 8px;
    min-width: 190px;
    padding: 16px 18px;
    border: 1px solid rgba(225, 230, 238, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
}

.detail-summary strong {
    font-size: 1.2rem;
}

.detail-station-cell {
    display: grid;
    gap: 3px;
}

    .detail-station-cell strong {
        font-size: 0.96rem;
    }

    .detail-station-cell span {
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
    }

.detail-order {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 900;
    background: var(--primary-soft);
}


.rank-g-m {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 800;
    background-image: linear-gradient(to right, #1FA2FF 0%, #12D8FA 0%, #1FA2FF 100%);
}

.rank-g-f {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: #101828;
    font-size: 0.84rem;
    font-weight: 800;
    background-image: linear-gradient(to right, #f857a6 0%, #ff5858 0%, #f857a6 100%);
}

.datestr {
    color: #101828;
    font-size: 0.84rem;
    font-weight: 800;
    background: #ffffff;
}

.timestr {
    color: #101828;
    font-size: 0.84rem;
    font-weight: 800;
    background: #ffffff;
}



@media (max-width: 1050px) {
    .podium-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .header-index {
        margin: 0;
        font-size: 1.5rem;
        font-weight: 800;
        line-height: 1;
    }

    .header-name {
        margin: 0;
        font-size: 1.5rem;
        font-weight: 800;
        line-height: 1;
    }

    .results-shell {
        width: min(100% - 20px, 520px);
        padding: 18px 0;
    }

    .detail-shell {
        width: min(100% - 20px, 520px);
        padding: 18px 0;
    }

    .board-header,
    .action-bar,
    .section-heading {
        display: grid;
        padding-left: 18px;
        padding-right: 18px;
    }

    .event-meta {
        text-align: left;
    }

    .detail-side {
        min-width: 0;
    }

    .distance-tabs {
        padding: 12px 14px;
    }

    .detail-station-cell {
        display: grid;
        gap: 3px;
    }

        .detail-station-cell strong {
            font-size: 12px !important;
        }

        .detail-station-cell span {
            color: var(--muted);
            font-size: 12px !important;
            font-weight: 700;
        }

    .summary-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        border-bottom: 1px solid var(--line);
    }

        .summary-grid article {
            padding: 5px 5px !important;
            border-right: 1px solid var(--line);
            background: var(--panel-strong);
            font-size: 12px !important;
            text-align: center;
        }

            .summary-grid article:last-child {
                border-right: 0;
            }

        .summary-grid span {
            display: block;
            margin-bottom: 6px;
            color: #b54708;
            font-size: 14px !important;
        }

        .summary-grid strong {
            font-size: 14px !important;
            color: #101828;
        }

    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .ghost-button,
    .print-button {
        width: 100%;
    }

    .podium-grid {
        grid-template-columns: 1fr;
        padding: 0 14px 14px;
    }

     table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        min-width: 0;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    tbody {
        display: grid;
        gap: 12px;
        padding: 14px;
    }

    tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
    }

    td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 12px 14px;
        border-top: 1px solid var(--line);
    }

        td:first-child {
            border-top: 0;
        }

        td::before {
            content: attr(data-label);
            color:#101828;
            font-size: 0.78rem;
            font-weight: 600;
            
        }



    .runner {
        text-align: right;
    }

    .tab-button {
        flex: 0 0 auto;
        min-width: 45px;
        padding: 5px 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
        color: var(--muted);
        font: inherit;
        font-weight: 800;
        background: #ffffff;
        cursor: pointer;
        font-size: 12px
    }

        .tab-button:hover {
            color: var(--text);
            border-color: #b9c3d3;
            background: var(--panel-strong);
        }

        .tab-button.active {
            color: #ffffff;
            border-color: var(--primary);
            background: var(--primary);
        }



    .search-box {
        display: grid;
        gap: 7px;
        width: min(520px, 100%);
    }

        .search-box span {
            color: var(--muted);
            font-size: 0.78rem;
            font-weight: 800;
        }

        .search-box input {
            width: 100%;
            min-height: 44px;
            padding: 10px 14px;
            border: 1px solid var(--line);
            border-radius: 8px;
            color: var(--text);
            font: inherit;
            font-weight: 600;
            background: var(--panel-strong);
            outline: none;
        }

            .search-box input:focus {
                border-color: var(--primary);
                background: #ffffff;
                box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.10);
            }

    .action-buttons {
        display: flex;
        gap: 10px;
        flex: 0 0 auto;
    }

    .ghost-button,
    .print-button {
        min-height: 10px;
        padding: 3px 5px;
        border: 1px solid var(--line);
        border-radius: 8px;
        font: inherit;
        font-weight: 800;
        cursor: pointer;
        font-size: 14px !important;
    }

    .ghost-button {
        color: var(--text);
        background: #ffffff;
    }

    .print-button {
        color: #ffffff;
        border-color: var(--primary);
        background: var(--primary);
    }


    .station {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 70px;
        padding: 2px 10px;
        border: 1px solid var(--line);
        border-radius: 999px;
        color: var(--muted);
        font-size: 12px !important;
        font-weight: 500;
        background: #ffffff;
    }

        .station.active {
            color: var(--warning);
            border-color: #fedf89;
            background: var(--warning-soft);
        }

        .station.done {
            color: var(--success);
            border-color: #abefc6;
            background: var(--success-soft);
        }

        .station.dnf {
            color: #b42318;
            border-color: #fecdca;
            background: #fff1f0;
        }

    .datestr {
        color: #101828;
        font-size: 12px !important;
        font-weight: 500;
        background: #ffffff;
    }

    .timestr {
        color: #101828;
        font-size: 12px !important;
        font-weight: 600;
        background: #ffffff;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .results-shell {
        width: 100%;
        padding: 0;
    }

    .scoreboard {
        border: 0;
        box-shadow: none;
    }

    .distance-tabs,
    .action-bar,
    .error-state {
        display: none;
    }

    .podium-card,
    tr {
        break-inside: avoid;
    }
}
