/* Leaderboard styles v5 */

:root {
    --tile-side: 55px;
    --tile-border: 2px;
    --tile-margin: 2px;
}

/* ── Title ── */
.lb-title {
    font-family: 'Yellowtail', cursive !important;
    text-transform: none !important;
    color: #232324 !important;
    font-size: 2.2rem;
    line-height: 1.3;
    text-align: center;
    margin: 1rem 0 0.4rem;
    white-space: nowrap;
}

/* ── Page ── */
.lb-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 20px;
}

/* ── Top bar ── */
.lb-topbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 0 4px;
}

.lb-tab {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 18px;
    color: #999;
    text-decoration: none;
    cursor: pointer;
}
.lb-tab.active {
    color: #232324;
    font-weight: bold;
    border-bottom: 2px solid #232324;
}
.lb-tab:hover:not(.active) { color: #555; }
.lb-tab-sep { color: #ccc; margin: 0 10px; font-size: 18px; }

.lb-game-sel {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 18px;
    font-weight: bold;
    border: none;
    background: transparent;
    color: #232324;
    cursor: pointer;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23232324' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right center;
    padding-right: 18px;
}
.lb-game-sel:focus { outline: none; }

/* ── Card ── */
.lb-card {
    width: 100%;
    padding: 8px 12px 10px;
    border: 1px solid #ddd;
    box-shadow: 0 0 8px rgba(0,0,0,0.06);
    background: white;
    border-radius: 4px;
}

/* ── Week bar ── */
.lb-weekbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.lb-arr {
    font-size: 16px;
    font-weight: bold;
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 9px;
    cursor: pointer;
    color: #232324;
    font-family: 'Brandon Grotesque', sans-serif;
}
.lb-arr:hover:not(:disabled) { background: #f0f0f0; }
.lb-arr:disabled { opacity: 0.25; cursor: default; }

.lb-daterange {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #232324;
    min-width: 110px;
    text-align: center;
}

.lb-sep { color: #ccc; margin: 0 1px; font-size: 16px; }

.lb-datepick {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
    padding: 1px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #232324;
    background: white;
    max-width: 150px;
}
.lb-datepick:focus { outline: none; border-color: #3860d6; }

.lb-today {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
    color: #3860d6;
    text-decoration: none;
    white-space: nowrap;
}
.lb-today:hover { text-decoration: underline; }

.lb-charttype { display: inline; }
.lb-charttype select {
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 6px;
    background: white;
    color: #232324;
}
.lb-charttype select:focus { outline: none; border-color: #3860d6; }

/* ── Weekly chart: fixed header row + scrollable body ── */
.lb-chart-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Column headers + footers — identical structure to lb-row */
.lb-colheaders,
.lb-colfooters {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-colheaders {
    border-bottom: 1px solid #ddd;
    padding-bottom: 3px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
}

.lb-colfooters {
    border-top: 1px solid #ddd;
    padding-top: 3px;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 2;
}

.lb-axis-labels {
    display: flex;
    align-items: center;
}

/* Labels reuse .tile-container for identical flex, styled via .x-axis-label */
.x-axis-label {
    flex: 0 0 var(--tile-side);
    width: var(--tile-side);
    height: auto;
    margin: 0 var(--tile-margin);
    box-sizing: content-box;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Brandon Grotesque', sans-serif;
    color: #50505a;
    line-height: 1.15;
    overflow: hidden;
    white-space: nowrap;
    background: none;
    border: var(--tile-border) solid transparent;
}

/* Scrollable chart body — stable gutter reserves scrollbar space always */
.lb-scroll {
    max-height: 420px;
    overflow-y: scroll;
    overscroll-behavior: contain;
    width: 100%;
    scrollbar-gutter: stable;
}

/* ── Leaderboard row ── */
.lb-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
    min-height: 55px;
}

.lb-name {
    position: relative;
    width: 90px;
    flex-shrink: 0;
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #232324;
    text-align: right;
    padding-right: 10px;
    overflow: visible;
    white-space: nowrap;
}

/* Trophy positioned dynamically to the left of the name */
.lb-trophy-img {
    position: absolute;
    right: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    display: block !important;
}

.tile-container {
    display: flex;
    align-items: center;
}

/* ── Tiles ── */
.tile {
    flex: 0 0 var(--tile-side);
    width: var(--tile-side);
    height: var(--tile-side);
    background-color: white;
    border: var(--tile-border) solid #d3d6da;
    margin: var(--tile-margin);
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    font-weight: bold;
    color: #232324;
    font-family: 'Brandon Grotesque', sans-serif;
    box-sizing: content-box;
}

.tile .fill {
    background-color: #6aaa64;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.dark-grey { background-color: #6b6b6b; color: white; }
.yellow    { background-color: #c9b458; color: #232324; }
.green     { background-color: #6aaa64; color: white; }

/* ── X-axis (hidden — replaced by column headers at top) ── */
.lb-xaxis { display: none; }

/* ── All-time table ── */
.lb-alltime-scroll {
    max-height: 480px;
    overflow-y: auto;
    overscroll-behavior: contain;
    width: 100%;
}

.alltime-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
}

.alltime-table thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
}

.alltime-table th {
    font-size: 16px;
    font-weight: bold;
    color: #888;
    text-align: center;
    padding: 6px 10px;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}
.alltime-table th.col-name { text-align: left; }

.alltime-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
}
.alltime-table .col-trophy { width: 28px; text-align: center; padding: 4px; }
.alltime-table .col-name { text-align: left; font-weight: bold; font-size: 16px; }
.alltime-table .col-num { text-align: center; font-variant-numeric: tabular-nums; }
.alltime-table .col-date { text-align: center; color: #888; font-size: 16px; }

.alltime-table img.trophy-sm, img.trophy-sm {
    width: 18px !important; height: 18px !important;
    max-width: 18px !important; max-height: 18px !important;
    display: inline-block !important; vertical-align: middle;
}

.family-row { background: #f7f8fa; }
.family-row td { border-bottom: 2px solid #ddd; }
.family-name { color: #3860d6 !important; }

/* ── Footer ── */
.lb-footer {
    text-align: center;
    margin-top: 12px;
    font-family: 'Brandon Grotesque', sans-serif;
    font-size: 16px;
}
.lb-footer a { color: #3860d6; text-decoration: none; }
.lb-footer a:hover { text-decoration: underline; }

/* ═══════ MOBILE ═══════ */
@media (max-width: 900px) {
    :root { --tile-side: 32px; --tile-border: 1px; --tile-margin: 1.5px; }
    .lb-title { font-size: 1.3rem; white-space: normal; margin-top: 0.8rem; }
    .lb-page { padding: 0 6px 16px; }
    .lb-card { padding: 6px 4px; }
    .lb-topbar { gap: 4px; }
    .lb-game-sel { font-size: 14px; }
    .lb-tab, .lb-tab-sep { font-size: 14px; }
    .lb-weekbar { gap: 3px; }
    .lb-arr { font-size: 13px; padding: 1px 6px; }
    .lb-daterange { font-size: 13px; min-width: auto; }
    .lb-sep { font-size: 13px; }
    .lb-datepick { font-size: 13px; max-width: 120px; }
    .lb-today { font-size: 13px; }
    .lb-charttype select { font-size: 13px; }
    .lb-scroll { max-height: 280px; }
    .lb-row { min-height: 36px; padding: 1px 0; }
    .lb-trophy-img { width: 14px !important; height: 14px !important; max-width: 14px !important; max-height: 14px !important; }
    .lb-name { width: 44px; font-size: 11px; padding-right: 4px; }
    .x-axis-label { font-size: 9px; }
    .tile { font-size: 14px; }
    .hide-mobile { display: none !important; }
    .alltime-table { font-size: 12px; }
    .alltime-table th { font-size: 9px; padding: 4px 3px; }
    .alltime-table td { padding: 5px 3px; }
    .alltime-table .col-name { font-size: 12px; }
    img.trophy-sm { width: 12px !important; height: 12px !important; }
    .lb-alltime-scroll { max-height: 320px; }
}
