h2 {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 2.6rem;
    letter-spacing: -0.02em;
}

.box95 {
    max-width: 95%;
}

.marginauto {
    display: block;
    margin: 20px auto;
    vertical-align: middle;
    text-align: center;
}

.btn {
    margin: 10px;
    text-align: center;
}

.rowbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.1rem auto;
}

/* ── Form wrapper ─────────────────────── */
form > table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1.5px solid var(--border) !important;
    overflow: hidden;
    margin: 2rem auto !important;
    padding: 0.5rem;
}

form > table td {
    background: transparent;
    border-bottom: none !important;
    border-right: 1px solid var(--primary-pale);
    padding: 1rem 1.4rem !important;
}

form > table td:last-child {
    border-right: none;
}

form > table tr:hover td {
    background: transparent;
}

/* ── Field labels ─────────────────────── */
.records_form {
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
    text-align: left;
}

.records_form b {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.5em;
}

/* Radio labels spacing */
.records_form input[type="radio"] {
    margin-right: 0.3em;
    margin-left: 0.6em;
}

.records_form input[type="radio"]:first-of-type {
    margin-left: 0;
}

.input[type=text] {
    max-width: 250px;
    margin: 0 auto;
    box-sizing: border-box;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: larger;
    padding: 0.4em 0.8em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input[type=text]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(69, 153, 212, 0.15);
}

/* ── Track icon ───────────────────────── */
.trackicon {
    width: 100%;
    max-width: 52px;
    height: auto;
    margin: 4px auto;
    vertical-align: middle;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(69,153,212,0.2));
    transition: transform 0.2s ease;
}

tr:hover .trackicon {
    transform: scale(1.08);
}

/* ── Venue record header ──────────────── */
.box_venue_records {
    display: flex;
    margin: 2rem auto;
    align-items: center;
    justify-content: center;
}

.trackimage {
    width: 100%;
    max-width: 280px;
    height: auto;
    margin-right: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.trackname {
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* ── Column headings ──────────────────── */
.recordheading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.headingicon {
    width: 100%;
    max-width: 20px;
    height: auto;
    vertical-align: middle;
    opacity: 0.85;
    filter: brightness(0) invert(1);
}

/* ── Scoreboard table container ───────── */
.tablebox {
    height: 700px;
    max-width: 1200px;
    overflow: auto;
    border-radius: var(--radius-lg);
    /* shadow already on table */
}

.tablebox table {
    margin: 0 !important;
    border-radius: 0;
}

/* Result column: monospace timing */
td:nth-child(7), th:nth-child(7) {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: 0.02em;
}

th:nth-child(7) {
    color: #fff;
}

/* "more" link pill */
td a {
    display: inline-block;
    padding: 0.25em 0.9em;
    border-radius: 20px;
    background: var(--primary-pale);
    color: var(--primary-dark);
    font-size: 1.3rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

td a:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Sticky header fix */
table th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ── Responsive ───────────────────────── */

/* Tablet : réduction légère */
@media (max-width: 900px) {
    .rowbox {
        display: block;
        align-items: center;
        text-align: center;
    }

    form > table td {
        border-right: none;
        border-bottom: 1px solid var(--primary-pale) !important;
    }
}

/* ── Mobile : formulaire empilé ───────── */
@media (max-width: 640px) {

    body {
        font-size: 1.5rem;
    }

    /* Le tableau HTML du formulaire devient un bloc flex vertical */
    form > table,
    form > table tbody,
    form > table tr,
    form > table td {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
    }

    /* La cellule rowspan=2 du bouton : masquée dans son tr d'origine,
       on réaffiche la cellule btn de la 2e ligne (qui n'existe pas côté HTML —
       le bouton est dans tr:first-child td:last-child avec rowspan=2).
       On la remet visible et on la place à la fin. */
    form > table tr:first-child td:last-child {
        order: 10;
        display: block !important;
    }

    form > table {
        padding: 1rem !important;
        border: 1.5px solid var(--border) !important;
        border-radius: var(--radius-lg) !important;
        margin: 1rem !important;
        width: auto !important;
    }

    .records_form {
        margin: 0.6rem 0;
        padding: 0.5rem 0.6rem;
        background: var(--bg);
        border-radius: 8px;
    }

    .records_form b {
        margin-bottom: 0.4em;
    }

    select {
        width: 100%;
        max-width: 100%;
    }

    /* Bouton Submit : pleine largeur, tout en bas */
    .btn {
        margin-top: 0.8rem;
    }

    .btn input[type="submit"] {
        width: 100%;
        padding: 1em;
    }

    /* ── Tableau → cartes empilées ─────── */
    .tablebox {
        height: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
        margin: 0.5rem !important;
        width: auto !important;
        border-radius: var(--radius-lg);
    }

    /* On cache l'en-tête classique */
    .tablebox table thead,
    .tablebox table tr:first-child {
        display: none !important;
    }

    /* Le tableau et ses lignes deviennent des blocs */
    .tablebox table,
    .tablebox table tbody,
    .tablebox table tr,
    .tablebox table td {
        display: block !important;
        width: 100% !important;
    }

    .tablebox table {
        box-shadow: none !important;
        background: transparent !important;
        border: none !important;
        margin: 0 !important;
    }

    /* Chaque ligne = une carte */
    .tablebox table tr {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
        margin-bottom: 1rem;
        padding: 1rem 1.2rem;
        border: 1.5px solid var(--border);
        position: relative;
    }

    .tablebox table tr:hover {
        background: var(--row-hover);
    }

    /* Toutes les cellules : inline-block avec label data-label */
    .tablebox table td {
        border: none !important;
        padding: 0.3em 0 !important;
        background: transparent !important;
        display: flex !important;
        align-items: center;
        gap: 0.6em;
        font-size: 1.5rem;
    }

    /* Labels fixes par position de colonne (pas de data-label dans le HTML) */
    .tablebox table td::before {
        font-size: 1.1rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--primary);
        min-width: 7em;
        flex-shrink: 0;
    }
    .tablebox table td:nth-child(1)::before { content: "Track"; }
    .tablebox table td:nth-child(2)::before { content: "Icon"; }
    .tablebox table td:nth-child(3)::before { content: "Direction"; }
    .tablebox table td:nth-child(4)::before { content: "Mode"; }
    .tablebox table td:nth-child(5)::before { content: "Laps"; }
    .tablebox table td:nth-child(6)::before { content: "Player"; }
    .tablebox table td:nth-child(7)::before { content: "Result"; }
    .tablebox table td:nth-child(8)::before { content: ""; min-width: 0; }

    /* Icône de piste : pas de zoom au hover sur mobile */
    .trackicon {
        max-width: 40px;
        margin: 0;
    }

    tr:hover .trackicon {
        transform: none;
    }

    /* Colonne résultat */
    .tablebox table td:nth-child(7) {
        font-size: 1.5rem;
    }

    /* Lien "more" : pleine largeur */
    .tablebox table td:last-child {
        margin-top: 0.4em;
        justify-content: flex-end;
    }

    td a {
        width: 100%;
        text-align: center;
        padding: 0.4em 1em;
    }

    /* playerTag dans les cartes */
    .playerTag {
        display: inline-flex;
        align-items: center;
    }
}


