/* Smartphone-Layout: Tabelle statt Karten */

:root {
    --content-width: 1400px;
}

body {
    margin: 0;
    padding: 0;
    background: #f4f6f8;
}

header {
    width: 100%;
    background: white;
    border-bottom: 1px solid #ddd;
}

header a {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem 0.8rem;
}

#logo {
    max-height: 64px;
    max-width: 92vw;
    width: auto;
}

main.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1rem;
}

#event-info {
    text-align: center;
    margin-bottom: 1rem;
}

#event-name {
    margin: 0 0 0.25rem 0;
    font-size: clamp(1.35rem, 5vw, 2.2rem);
    line-height: 1.15;
}

#event-date {
    margin: 0;
}

#categories-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.2rem;
}

#categories-navigation button {
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-weight: 600;
    width: auto;
    margin: 0;

    background: #db002f;
    border-color: #db002f;
    color: white;
}

#categories-navigation button:hover {
    background: #b80027;
    border-color: #b80027;
}

#categories-navigation button.primary {
    background: #8f001e;
    border-color: #8f001e;
}

.class-block {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.class-block h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.results {
    width: 100%;
    border-collapse: collapse;
}

table.results thead {
    background: #111827;
    color: white;
    position: static;
}

table.results th,
table.results td {
    padding: 0.75rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

table.results tbody tr:hover {
    background: #f9fafb;
}

.rank-1 {
    background: rgba(255, 215, 0, 0.14);
}

.rank-2 {
    background: rgba(192, 192, 192, 0.14);
}

.rank-3 {
    background: rgba(205, 127, 50, 0.14);
}

footer {
    width: 100%;
    max-width: var(--content-width);
    margin: 2rem auto;
    padding: 1rem;
    text-align: center;
    color: #666;
}

/* Smartphone: echte Tabelle, kompakt und horizontal scrollbar */
@media (max-width: 700px) {
    body {
        background: #eef1f5;
    }

    main.container {
        padding: 0.45rem;
    }

    header a {
        padding: 0.45rem;
    }

    #logo {
        max-height: 50px;
    }

    #event-info {
        background: white;
        border-radius: 12px;
        padding: 0.75rem;
        margin-bottom: 0.65rem;
        box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    }

    #event-name {
        font-size: 1.35rem;
    }

    #categories-navigation {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0.2rem 0 0.65rem 0;
        margin-bottom: 0.65rem;
        scrollbar-width: thin;
    }

    #categories-navigation button {
        flex: 0 0 auto;
        padding: 0.42rem 0.72rem;
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .class-block {
        padding: 0.55rem;
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .class-block h2 {
        margin-bottom: 0.6rem;
        font-size: 1.18rem;
    }

    .table-scroll {
        overflow-x: auto;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
    }

    table.results {
        min-width: 720px;
        width: 720px;
        font-size: 0.78rem;
        background: white;
    }

    table.results th,
    table.results td {
        padding: 0.42rem 0.35rem;
        line-height: 1.2;
        white-space: nowrap;
    }

    table.results th {
        font-size: 0.72rem;
        font-weight: 700;
    }

    table.results td {
        font-size: 0.78rem;
    }

    table.results th:nth-child(1),
    table.results td:nth-child(1) {
        width: 58px;
        text-align: center;
        font-weight: 700;
    }

    table.results th:nth-child(2),
    table.results td:nth-child(2) {
        width: 54px;
        text-align: center;
    }

    table.results th:nth-child(3),
    table.results td:nth-child(3) {
        width: 170px;
        max-width: 170px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
    }

    table.results th:nth-child(4),
    table.results td:nth-child(4) {
        width: 130px;
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    table.results th:nth-child(5),
    table.results td:nth-child(5),
    table.results th:nth-child(6),
    table.results td:nth-child(6),
    table.results th:nth-child(7),
    table.results td:nth-child(7) {
        width: 90px;
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    table.results tbody tr:nth-child(even) {
        background: #fafafa;
    }

    table.results tbody tr:hover {
        background: inherit;
    }

    footer {
        padding: 0.75rem;
        margin: 1rem auto;
        font-size: 0.88rem;
    }
}

/* Sehr kleine Smartphones */
@media (max-width: 380px) {
    table.results {
        min-width: 680px;
        width: 680px;
        font-size: 0.74rem;
    }

    table.results th,
    table.results td {
        padding: 0.36rem 0.3rem;
    }

    table.results th:nth-child(3),
    table.results td:nth-child(3) {
        width: 150px;
        max-width: 150px;
    }

    table.results th:nth-child(4),
    table.results td:nth-child(4) {
        width: 110px;
        max-width: 110px;
    }
}
/* Smartphone-Fix: alle Kategorien sichtbar anzeigen */

@media (max-width: 700px) {
    #categories-navigation {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.35rem;
        overflow-x: visible;
        padding: 0.25rem 0 0.65rem 0;
        margin-bottom: 0.65rem;
    }

    #categories-navigation button {
        flex: 0 1 auto;
        width: auto;
        max-width: 100%;
        padding: 0.42rem 0.7rem;
        font-size: 0.84rem;
        line-height: 1.15;
        white-space: normal;
        text-align: center;
        background: #db002f;
        border-color: #db002f;
        color: white;
    }

    #categories-navigation button:hover {
        background: #b80027;
        border-color: #b80027;
    }

    #categories-navigation button.primary {
        background: #8f001e;
        border-color: #8f001e;
    }
}

@media (max-width: 380px) {
    #categories-navigation {
        gap: 0.28rem;
    }

    #categories-navigation button {
        font-size: 0.78rem;
        padding: 0.36rem 0.55rem;
    }
}
/* Darkmode Fix für Tabellen-Header auf Smartphone */

@media (prefers-color-scheme: dark) {

    table.results thead {
        background: #111827 !important;
    }

    table.results thead th {
        color: white !important;
    }

    .class-block {
        background: #1f2937;
    }

    table.results {
        background: #1f2937;
        color: #f3f4f6;
    }

    table.results tbody tr:nth-child(even) {
        background: rgba(255,255,255,0.03);
    }

    table.results td {
        border-bottom-color: rgba(255,255,255,0.08);
    }
}
/* Darkmode Fix für Eventtitel */

@media (prefers-color-scheme: dark) {

    body {
        background: #111827;
        color: #f3f4f6;
    }

    #event-info {
        background: #1f2937;
    }

    #event-name {
        color: #ffffff;
    }

    #event-date {
        color: #d1d5db;
    }

    .class-block h2 {
        color: #ffffff;
        border-bottom-color: rgba(255,255,255,0.08);
    }

    footer {
        color: #d1d5db;
    }

    footer a {
        color: #ffffff;
    }
}