/* ============================================================
   Leaderboard page
   ============================================================ */

body {
    display: block;
    align-items: unset;
    justify-content: unset;
    padding: 0;
}

/* --- Layout ------------------------------------------------- */

.lb-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 0 4rem;
}

/* --- Header ------------------------------------------------- */

.lb-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.4rem;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.lb-header h1 {
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin: 0;
    flex: 1;
}

.lb-back {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.15s;
}

.lb-back:hover { color: var(--color-text); }

.lb-subtitle {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
    white-space: nowrap;
}

/* --- Empty state ------------------------------------------- */

.lb-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --- Tab bar ----------------------------------------------- */

.lb-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0 1.2rem;
    border-bottom: 1px solid #222;
    margin-top: 0.8rem;
}

.lb-tab {
    font-family: monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.55rem 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px; /* overlap the container border-bottom */
}

.lb-tab:hover {
    color: var(--color-text);
}

.lb-tab.is-active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* --- Panels ------------------------------------------------- */

.lb-main {
    padding: 1.2rem 1.2rem 0;
}

.lb-panel {
    display: none;
}

.lb-panel.is-active {
    display: block;
}

/* --- Table -------------------------------------------------- */

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

.lb-table thead tr {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #444;
    border-bottom: 1px solid #1e1e1e;
}

.lb-table thead th {
    padding: 0.3rem 0.6rem;
    font-weight: normal;
    text-align: left;
}

.lb-row {
    border-bottom: 1px solid #151515;
    transition: background 0.1s;
}

.lb-row:hover { background: #161616; }

.lb-row td {
    padding: 0.55rem 0.6rem;
    vertical-align: middle;
}

/* --- Column widths ------------------------------------------ */

.lb-col-rank { width: 2.5rem; text-align: center; }
.lb-col-heat { width: 5rem;   color: var(--color-muted); font-size: 0.72rem; white-space: nowrap; }
.lb-col-time { width: 10rem;  text-align: right; }
.lb-col-team { }

/* --- Rank cell ---------------------------------------------- */

.lb-col-rank {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Podium highlights */
.lb-row--gold   td:first-child { color: #d4b800; font-size: 1.1rem; }
.lb-row--silver td:first-child { color: #aaaaaa; }
.lb-row--bronze td:first-child { color: #c87840; }

.lb-row--gold   { background: rgba(212, 184, 0, 0.04); }
.lb-row--silver { background: rgba(170, 170, 170, 0.03); }
.lb-row--bronze { background: rgba(200, 120, 64, 0.03); }

/* --- Team cell ---------------------------------------------- */

.lb-col-team {
    font-size: 0.82rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

/* Sub-category label, shown next to the team name in scratch mode */
.lb-subcat {
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-dim, #888);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1em 0.45em;
    border-radius: 4px;
    white-space: nowrap;
}

/* Heat color dot */

/* --- Time cell ---------------------------------------------- */

.lb-time {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--color-text);
    display: block;
}

.lb-row--gold   .lb-time { color: #d4b800; }
.lb-row--silver .lb-time { color: #aaaaaa; }
.lb-row--bronze .lb-time { color: #c87840; }

/* Penalty breakdown — smaller, muted, below the total */
.lb-penalty {
    display: block;
    font-size: 0.62rem;
    color: #666;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.lb-penalty__amount {
    color: #e06000;
}

/* --- DNF ---------------------------------------------------- */

.lb-row--abandon { opacity: 0.45; }

.lb-dnf {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #555;
}

.lb-dnf-time { color: #444; }

/* --- Expandable row ---------------------------------------- */

.lb-row--expandable {
    cursor: pointer;
}

.lb-row--expandable:hover .lb-col-team {
    color: var(--color-accent);
}

.lb-expand-icon {
    font-size: 0.55rem;
    color: var(--color-muted);
    margin-left: 0.35rem;
    vertical-align: middle;
    transition: color 0.15s;
    user-select: none;
}

/* --- Splits row -------------------------------------------- */

.lb-splits-row {
    display: none;
}

.lb-splits-row.is-open {
    display: table-row;
}

.lb-splits-cell {
    padding: 0 0.6rem 0.8rem !important;
    background: #0d0d0d;
    border-bottom: 1px solid #1a1a1a;
}

.lb-splits-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    padding: 0.5rem 0.2rem 0.2rem;
}

.lb-split-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 5.5rem;
    padding: 0.35rem 0.5rem;
    background: #141414;
    border: 1px solid #222;
    border-radius: 4px;
}

.lb-split-title {
    font-size: 0.52rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    white-space: nowrap;
    margin-bottom: 0.15rem;
}

.lb-split-cumul {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--color-text);
    font-weight: bold;
}

.lb-split-segment {
    font-family: monospace;
    font-size: 0.62rem;
    color: var(--color-muted);
    margin-top: 0.05rem;
}

/* --- Responsive -------------------------------------------- */

@media (max-width: 540px) {
    .lb-col-heat    { display: none; }
    .lb-col-time    { width: 7rem; }
    .lb-subtitle    { display: none; }

    .lb-split-item  { min-width: 4.5rem; }
    .lb-split-cumul { font-size: 0.78rem; }
}
