/* Farben nach Rolle, hell und dunkel je eigene Stufen (wie im UDisc Round Analyzer) */
:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --surface-2: #f0efeb;
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    --accent: #2a78d6;
    --link: #1c5cab;
    --wash: rgba(42, 120, 214, 0.08);
    --area: rgba(42, 120, 214, 0.10);
    --up: #1f7a45;
    --up-wash: rgba(31, 122, 69, 0.12);
    --down: #b3322c;
    --down-wash: rgba(179, 50, 44, 0.11);
    --gold: #a8740a;
    --critical: #d03b3b;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --surface-2: #232321;
        --text: #f0efec;
        --text-2: #c3c2b7;
        --muted: #898781;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, 0.10);
        --accent: #3987e5;
        --link: #86b6ef;
        --wash: rgba(57, 135, 229, 0.14);
        --area: rgba(57, 135, 229, 0.16);
        --up: #5cc98a;
        --up-wash: rgba(92, 201, 138, 0.15);
        --down: #f0857c;
        --down-wash: rgba(240, 133, 124, 0.15);
        --gold: #e3b341;
        --critical: #e66767;
        --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.45;
}

h1, h2, h3 {
    line-height: 1.2;
}

h1:focus {
    outline: none;
}

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

/* Kopf und Fuß */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
}

    .nav a {
        color: var(--text-2);
        text-decoration: none;
    }

        .nav a:hover {
            color: var(--text);
        }

        .nav a.active {
            color: var(--text);
            font-weight: 600;
        }

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 24px;
}

.bottom {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 16px 24px;
    color: var(--text-2);
    font-size: 0.8rem;
    text-align: center;
}

.muted {
    color: var(--text-2);
}

.small {
    font-size: 0.8rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.error {
    color: var(--critical);
}

    .error::before {
        content: "⚠ ";
    }

.notice {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.85rem;
}

.loading {
    padding: 32px 0;
    color: var(--text-2);
    text-align: center;
}

.empty {
    padding: 24px 0;
    color: var(--text-2);
    text-align: center;
}

/* Kopf einer Seite */
.page-head {
    margin-top: 16px;
}

    .page-head h1 {
        margin: 2px 0 2px;
        font-size: 1.6rem;
    }

    .page-head p {
        margin: 0;
        color: var(--text-2);
        font-size: 0.85rem;
    }

.up-link {
    display: inline-block;
    padding: 4px 0;
    color: var(--link);
    font-size: 0.9rem;
    text-decoration: none;
}

    .up-link:hover {
        text-decoration: underline;
    }

/* Eingaben */
.search {
    width: 100%;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid var(--axis);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

select {
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--axis);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

    .filters select {
        flex: 1 1 160px;
        min-width: 0;
    }

@media (min-width: 760px) {
    .filters select {
        flex: 0 1 260px;
    }
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--axis);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

    .button:hover {
        background: var(--wash);
    }

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

.link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--link);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

    .link:hover {
        text-decoration: underline;
    }

/* Umschalter mit wenigen Möglichkeiten (Zeitraum, Sortierung): eine Spur, die gewählte gefüllt */
.segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--surface-2);
}

    .segment button {
        padding: 5px 12px;
        border: 0;
        border-radius: 8px;
        background: none;
        color: var(--text-2);
        font: inherit;
        font-size: 0.85rem;
        cursor: pointer;
    }

        .segment button:hover {
            color: var(--text);
        }

        .segment button[aria-pressed=true] {
            background: var(--surface);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
            color: var(--text);
            font-weight: 600;
        }

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

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 12px;
}

/* Reiter: bleiben beim Scrollen oben stehen, auf dem Handy seitwärts scrollbar */
.tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    margin: 12px -16px 0;
    padding: 0 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--grid);
    background: var(--page);
    scrollbar-width: none;
}

    .tabs a {
        flex: none;
        margin-bottom: -1px;
        padding: 12px 12px 10px;
        border-bottom: 2px solid transparent;
        color: var(--text-2);
        font-size: 0.9rem;
        text-decoration: none;
        white-space: nowrap;
    }

        .tabs a:hover {
            color: var(--text);
        }

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

        .tabs a[aria-current=page] {
            border-bottom-color: var(--accent);
            color: var(--text);
            font-weight: 600;
        }

/* Listen: eine Zeile je Eintrag, Titel und Zusatz links, Zahlen rechts; antippbare Zeilen sind Links */
.list {
    margin: 0;
    padding: 0;
    list-style: none;
}

    .list > li + li {
        border-top: 1px solid var(--grid);
    }

.item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    padding: 8px 6px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
}

a.item:hover, button.item:hover {
    background: var(--wash);
}

a.item:focus-visible, button.item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

button.item {
    cursor: pointer;
}

.item-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.item-title {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-meta {
    overflow: hidden;
    color: var(--text-2);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-extra {
    color: var(--muted);
    font-size: 0.75rem;
}

.figure {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    min-width: 44px;
}

    .figure strong {
        font-size: 1rem;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .figure small {
        color: var(--text-2);
        font-size: 0.7rem;
        white-space: nowrap;
    }

.chevron {
    flex: none;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
}

.rank {
    display: grid;
    flex: none;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 4px;
    border-radius: 14px;
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

    .rank.podium {
        background: var(--wash);
        box-shadow: inset 0 0 0 1px var(--accent);
        color: var(--link);
    }

.date-block {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    width: 44px;
    color: var(--text-2);
    font-size: 0.7rem;
    line-height: 1.2;
}

    .date-block strong {
        color: var(--text);
        font-size: 1rem;
        font-variant-numeric: tabular-nums;
    }

/* Kleine Marken: Wert in einer Pille, Veränderung farbig */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.delta {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

    .delta.up {
        color: var(--up);
    }

    .delta.down {
        color: var(--down);
    }

.pill.up {
    background: var(--up-wash);
    color: var(--up);
}

.pill.down {
    background: var(--down-wash);
    color: var(--down);
}

.star {
    color: var(--gold);
}

/* Profilkopf */
.profile {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-top: 8px;
}

.person {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

    .person h1 {
        margin: 0;
        font-size: 1.6rem;
    }

    .person p {
        margin: 2px 0 0;
        color: var(--text-2);
        font-size: 0.9rem;
    }

.avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wash);
    color: var(--link);
    font-size: 1.2rem;
    font-weight: 600;
}

.big-rating {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

    .big-rating .value {
        font-size: 2.8rem;
        font-weight: 700;
        line-height: 1;
        font-variant-numeric: tabular-nums;
    }

    .big-rating .caption {
        color: var(--text-2);
        font-size: 0.8rem;
    }

    .big-rating .place {
        text-align: right;
    }

        .big-rating .place strong {
            display: block;
            font-size: 1.6rem;
            line-height: 1.1;
        }

/* Kacheln und Karten */
.tiles {
    display: grid;
    margin-top: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 760px) {
    .tiles {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.tile, .card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.tile {
    padding: 12px 16px;
}

.tile-label {
    color: var(--text-2);
    font-size: 0.85rem;
}

.tile-value {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.tile-sub {
    overflow: hidden;
    color: var(--text-2);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cards {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 900px) {
    .cards.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

.card {
    padding: 16px;
}

    .cards .card {
        margin-top: 0;
    }

    .card h2 {
        margin: 0 0 4px;
        font-size: 1.1rem;
    }

    .card .sub {
        margin: 0 0 12px;
        color: var(--text-2);
        font-size: 0.85rem;
    }

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

    .card-head h2 {
        margin: 0;
    }

.list-card {
    margin-top: 16px;
    padding: 8px 10px;
}

/* Kennzahlen in einer Karte: Beschriftung klein, Wert groß */
.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin: 0;
}

    .facts div {
        min-width: 0;
    }

    .facts dt {
        color: var(--text-2);
        font-size: 0.8rem;
    }

    .facts dd {
        margin: 0;
        font-size: 1.15rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

        .facts dd small {
            display: block;
            overflow: hidden;
            color: var(--text-2);
            font-size: 0.75rem;
            font-weight: 400;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

/* Zeilen in einer Karte: Beschriftung links, Wert rechts */
.rows {
    margin: 0;
    padding: 0;
    list-style: none;
}

    .rows li {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
    }

        .rows li + li {
            border-top: 1px solid var(--grid);
        }

    .rows .label {
        min-width: 0;
    }

        .rows .label strong {
            display: block;
        }

        .rows .label > span {
            display: block;
            overflow: hidden;
            color: var(--text-2);
            font-size: 0.8rem;
            text-overflow: ellipsis;
        }

    .rows .value {
        flex: none;
        font-size: 1.05rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        text-align: right;
    }

        .rows .value small {
            margin-left: 4px;
        }

/* Turnier mit seinen Runden zum Aufklappen */
details.start > summary {
    list-style: none;
    cursor: pointer;
}

    details.start > summary::-webkit-details-marker {
        display: none;
    }

    details.start > summary:hover {
        background: var(--wash);
    }

    details.start > summary:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    details.start > summary .chevron {
        transition: transform 0.15s;
    }

details.start[open] > summary .chevron {
    transform: rotate(90deg);
}

.rounds {
    margin: 0 6px 10px 60px;
}

    .rounds table {
        width: 100%;
        max-width: 480px;
    }

    .rounds .links {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 16px;
        margin-top: 6px;
        font-size: 0.85rem;
    }

/* Tabellen */
.table-scroll {
    overflow-x: auto;
}

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

    table.data th, table.data td {
        padding: 6px 8px;
        border-bottom: 1px solid var(--grid);
        text-align: left;
        vertical-align: top;
    }

    table.data thead th {
        color: var(--text-2);
        font-size: 0.8rem;
        font-weight: 600;
    }

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

    table.data tr.struck td {
        color: var(--muted);
        text-decoration: line-through;
    }

        table.data tr.struck td.keep {
            text-decoration: none;
        }

@media (max-width: 480px) {
    table.data th, table.data td {
        padding: 6px 4px;
    }
}

/* Änderungen im Verlauf */
.change {
    padding: 10px 6px;
    border-radius: 8px;
}

    .change.selected {
        background: var(--wash);
    }

.change-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

.change ul {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

    .change ul li {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.tag-in {
    color: var(--up);
    font-weight: 600;
}

.tag-out {
    color: var(--down);
    font-weight: 600;
}

/* Diagramm */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 6px;
    color: var(--text-2);
    font-size: 0.8rem;
}

    .legend span {
        white-space: nowrap;
    }

.key {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: middle;
}

    .key.up {
        background: var(--up);
    }

    .key.down {
        background: var(--down);
    }

    .key.hollow {
        border: 2px solid var(--text-2);
    }

.chart {
    position: relative;
    overflow: hidden;
    user-select: none;
}

    .chart svg {
        display: block;
    }

    .chart .grid {
        stroke: var(--grid);
        stroke-width: 1;
    }

    .chart .axis {
        stroke: var(--axis);
        stroke-width: 1;
    }

    .chart .tick {
        fill: var(--muted);
        font-size: 11px;
        font-variant-numeric: tabular-nums;
    }

    .chart .line {
        fill: none;
        stroke: var(--accent);
        stroke-width: 2;
        stroke-linejoin: round;
    }

    .chart .area {
        fill: var(--area);
        stroke: none;
    }

    .chart .marker {
        stroke: var(--surface);
        stroke-width: 1.5;
    }

        .chart .marker.up {
            fill: var(--up);
        }

        .chart .marker.down {
            fill: var(--down);
        }

        .chart .marker.flat {
            fill: var(--text-2);
        }

        .chart .marker.hollow {
            fill: var(--surface);
            stroke-width: 2;
        }

            .chart .marker.hollow.up {
                stroke: var(--up);
            }

            .chart .marker.hollow.down {
                stroke: var(--down);
            }

            .chart .marker.hollow.flat {
                stroke: var(--text-2);
            }

        .chart .marker.selected {
            stroke: var(--text);
            stroke-width: 2;
        }

    .chart .end, .chart .active {
        fill: var(--accent);
        stroke: var(--surface);
        stroke-width: 2;
    }

    .chart .end-label {
        fill: var(--text-2);
        font-size: 12px;
        font-weight: 600;
    }

    .chart .crosshair {
        stroke: var(--text-2);
        stroke-width: 1;
        opacity: 0.5;
    }

.chart-hit {
    position: absolute;
    border-radius: 4px;
    cursor: crosshair;
    touch-action: pan-y;
    outline: none;
}

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

.tooltip {
    position: absolute;
    z-index: 2;
    min-width: 140px;
    max-width: 260px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 0.8rem;
    pointer-events: none;
}

.tooltip-title, .tooltip-detail {
    color: var(--text-2);
}

.tooltip-title {
    margin-bottom: 2px;
}

.tooltip-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tooltip-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

    .tooltip-row strong {
        font-size: 1rem;
        font-variant-numeric: tabular-nums;
    }

/* Ladeanzeige und Fehlerleiste von Blazor */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: var(--grid);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--accent);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Lädt");
    }

/* Turniere */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

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

    a.pill:hover {
        background: var(--wash);
    }

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 10px 0 0;
    font-size: 0.9rem;
}

.date-block.running strong {
    color: var(--up);
}

@media (min-width: 760px) {
    .facts.four {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.flights {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 760px) {
    .flights {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        align-items: start;
    }
}

    .flights .card {
        margin-top: 0;
    }

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

        .flights .rows a:hover strong {
            text-decoration: underline;
        }

/* Touren */
a.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

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

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

.field-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 0.9rem;
}

input[type=date] {
    padding: 6px 8px;
    border: 1px solid var(--axis);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

details.card > summary {
    cursor: pointer;
}

details.events[open] > summary {
    margin-bottom: 8px;
}
