/* ============================================================
   LEADERBOARD HISTORY PANEL
   Inline history panel rendered inside the Start-Screen's
   Leaderboard tab.  All selectors are scoped under  ss-lb-*
   so they cannot collide with the post-victory LeaderboardScreen
   (which uses  lb-*  selectors).
   ============================================================ */

/* ── title row ── */
.ss-lb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 18px;
}

.ss-lb-trophy {
    font-size: 2rem;
    filter: drop-shadow(0 3px 8px rgba(255, 215, 0, 0.45));
    animation: ss-trophy-bob 2.4s ease-in-out infinite;
}

@keyframes ss-trophy-bob {
    0%, 100% { transform: translateY(0);   }
    50%      { transform: translateY(-5px); }
}

.ss-lb-title {
    font-family: 'Georgia', serif;
    font-size: 1.9rem;
    font-weight: bold;
    color: #fff;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5),
                 0 0 20px rgba(255, 71, 87, 0.2);
}

/* ── column headers ── */
.ss-lb-colhead {
    display: grid;
    grid-template-columns: 44px 1fr 72px 160px;
    gap: 0 12px;
    width: 100%;
    max-width: 680px;
    padding: 0 18px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.ss-lb-colhead span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.38);
    font-family: 'Georgia', serif;
}

.ss-lb-col-rank  { text-align: center; }
.ss-lb-col-time  { text-align: right;  }
.ss-lb-col-date  { text-align: right;  }


/* ============================================================
   BODY WRAPPER  –  flex column that fills the remaining
   viewport below header + colhead.  The list scrolls inside;
   the nav bar sticks to the bottom.

   Offset breakdown (default / desktop):
     tab-bar padding-top   62 px   (from .ss-content-wrap)
     header  (trophy+title + margins) ≈ 60 px
     colhead (label row + margin)      ≈ 26 px
     bottom breathing room            ≈ 24 px
   Total ≈ 172 px  →  use 180 px for a comfortable margin.
   ============================================================ */
.ss-lb-body-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    /* fill from current cursor down to bottom of viewport */
    height: calc(100vh - 180px);
    box-sizing: border-box;
}


/* ── scrollable list  (flex-grows to fill body-wrap minus nav) ── */
.ss-lb-list {
    flex: 1;                            /* eat all space nav doesn't need */
    min-height: 0;                      /* critical: lets flex child scroll */
    overflow-y: auto;
    padding: 0 4px;
    box-sizing: border-box;

    scrollbar-width: thin;
    scrollbar-color: rgba(255, 71, 87, 0.35) transparent;
}

.ss-lb-list::-webkit-scrollbar        { width: 5px; }
.ss-lb-list::-webkit-scrollbar-track  { background: transparent; }
.ss-lb-list::-webkit-scrollbar-thumb  {
    background: rgba(255, 71, 87, 0.35);
    border-radius: 3px;
}

/* ── single row ── */
.ss-lb-row {
    display: grid;
    grid-template-columns: 44px 1fr 72px 160px;
    gap: 0 12px;
    align-items: center;
    padding: 13px 18px;
    margin-bottom: 7px;
    background: rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: background 0.22s, border-color 0.22s, transform 0.18s;
}

.ss-lb-row:hover {
    background: rgba(0, 0, 0, 0.48);
    border-color: rgba(255, 71, 87, 0.28);
    transform: translateX(3px);
}

/* gold/silver/bronze subtle border tint for top 3 */
.ss-lb-row--medal { border-color: rgba(255, 215, 0, 0.25); }

/* ── cells ── */
.ss-lb-cell--rank {
    text-align: center;
}

.ss-lb-medal {
    font-size: 1.35rem;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}

.ss-lb-rank-num {
    font-size: 1rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.42);
    font-family: 'Courier New', monospace;
}

/* top-3 rank numbers get colour  (nth-child still works – only 10 rows exist) */
.ss-lb-row:nth-child(1) .ss-lb-rank-num { color: #ffd700; }
.ss-lb-row:nth-child(2) .ss-lb-rank-num { color: #c0c0c0; }
.ss-lb-row:nth-child(3) .ss-lb-rank-num { color: #cd7f32; }

/* name cell: avatar circle + text side-by-side */
.ss-lb-cell--name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ss-lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 2px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.ss-lb-name-text {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* time */
.ss-lb-cell--time {
    text-align: right;
    font-size: 1rem;
    font-weight: bold;
    color: #ffd700;
    font-family: 'Courier New', monospace;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* date & time */
.ss-lb-cell--date {
    text-align: right;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

/* empty state */
.ss-lb-empty {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 1.05rem;
    font-style: italic;
    padding: 56px 20px;
}


/* ============================================================
   PAGINATION NAV BAR
   Sits at the bottom of .ss-lb-body-wrap (flex-shrink: 0).
   Matches the glassmorphism row aesthetic.
   ============================================================ */
.ss-lb-nav {
    flex-shrink: 0;                     /* never shrink – list scrolls instead */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 18px;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    margin-bottom: 8px;                 /* breathing room at very bottom */
}

/* prev / next buttons */
.ss-lb-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    background: rgba(255, 71, 87, 0.22);
    border: 1px solid rgba(255, 71, 87, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    outline: none;
}

.ss-lb-nav-btn:hover {
    background: rgba(255, 71, 87, 0.38);
    border-color: rgba(255, 71, 87, 0.6);
    transform: scale(1.08);
}

.ss-lb-nav-btn:active {
    transform: scale(0.96);
}

/* disabled state – muted, no pointer */
.ss-lb-nav-btn--disabled {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: default;
    pointer-events: none;
}

.ss-lb-nav-btn--disabled .ss-lb-nav-arrow {
    color: rgba(255, 255, 255, 0.25);
}

/* arrow glyph */
.ss-lb-nav-arrow {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    line-height: 1;
}

/* "Page X / Y" label */
.ss-lb-nav-indicator {
    font-size: 0.88rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Georgia', serif;
    letter-spacing: 0.5px;
    min-width: 72px;
    text-align: center;
}


/* ============================================================
   RESPONSIVE  –  desktop ≥ 1200
   ============================================================ */
@media (min-width: 1200px) {
    .ss-lb-title       { font-size: 2.1rem; }
    .ss-lb-body-wrap   { max-width: 740px; height: calc(100vh - 185px); }
    .ss-lb-colhead     { max-width: 740px; }
}


/* ============================================================
   RESPONSIVE  –  tablet landscape 900-1199
   ============================================================ */
@media (max-width: 1199px) and (min-width: 900px) {
    .ss-lb-body-wrap   { max-width: 660px; }
    .ss-lb-colhead     { max-width: 660px; }
}


/* ============================================================
   RESPONSIVE  –  tablet portrait / small laptop 650-899
   ============================================================ */
@media (max-width: 899px) and (min-width: 650px) {
    .ss-lb-title   { font-size: 1.75rem; }

    .ss-lb-colhead,
    .ss-lb-row {
        grid-template-columns: 38px 1fr 64px 140px;
    }

    .ss-lb-cell--date  { font-size: 0.72rem; }
    .ss-lb-body-wrap   { height: calc(100vh - 175px); }
}


/* ============================================================
   RESPONSIVE  –  mobile  < 650
   ============================================================ */
@media (max-width: 649px) {
    .ss-lb-header  { margin-top: 8px; margin-bottom: 14px; gap: 8px; }
    .ss-lb-trophy  { font-size: 1.6rem; }
    .ss-lb-title   { font-size: 1.45rem; }

    .ss-lb-colhead,
    .ss-lb-row {
        grid-template-columns: 34px 1fr 58px 120px;
        padding: 11px 12px;
    }

    .ss-lb-colhead { padding: 0 12px; }

    .ss-lb-cell--date { font-size: 0.68rem; }
    .ss-lb-avatar     { width: 32px; height: 32px; font-size: 0.82rem; }
    .ss-lb-name-text  { font-size: 0.9rem; }
    .ss-lb-cell--time { font-size: 0.9rem; }

    .ss-lb-row         { margin-bottom: 5px; border-radius: 10px; }
    .ss-lb-body-wrap   { height: calc(100vh - 162px); }

    /* nav tighter on mobile */
    .ss-lb-nav         { padding: 10px 14px; gap: 12px; margin-top: 4px; }
    .ss-lb-nav-btn     { width: 36px; height: 32px; }
    .ss-lb-nav-arrow   { font-size: 1.1rem; }
    .ss-lb-nav-indicator { font-size: 0.82rem; min-width: 64px; }
}


/* ============================================================
   RESPONSIVE  –  very small mobile  < 480
   drop the Date column entirely  →  3-col grid
   ============================================================ */
@media (max-width: 479px) {
    .ss-lb-colhead,
    .ss-lb-row {
        grid-template-columns: 32px 1fr 56px;
    }

    .ss-lb-col-date,
    .ss-lb-cell--date {
        display: none;
    }

    .ss-lb-row           { padding: 10px 10px; }
    .ss-lb-avatar        { width: 28px; height: 28px; font-size: 0.78rem; }
    .ss-lb-name-text     { font-size: 0.82rem; }
    .ss-lb-cell--time    { font-size: 0.82rem; }
    .ss-lb-medal         { font-size: 1.15rem; }
    .ss-lb-body-wrap     { height: calc(100vh - 155px); }
}


/* ============================================================
   RESPONSIVE  –  tiny  < 360
   ============================================================ */
@media (max-width: 359px) {
    .ss-lb-title   { font-size: 1.2rem; }
    .ss-lb-trophy  { font-size: 1.35rem; }
    .ss-lb-body-wrap { height: calc(100vh - 148px); }
}


/* ============================================================
   RESPONSIVE  –  landscape on short phones
   ============================================================ */
@media (max-height: 480px) and (orientation: landscape) {
    .ss-lb-header     { margin-top: 4px; margin-bottom: 8px; }
    .ss-lb-trophy     { font-size: 1.2rem; }
    .ss-lb-title      { font-size: 1.1rem; }

    .ss-lb-colhead,
    .ss-lb-row        { grid-template-columns: 30px 1fr 52px; padding: 8px 10px; }

    .ss-lb-col-date,
    .ss-lb-cell--date { display: none; }

    .ss-lb-avatar     { width: 26px; height: 26px; font-size: 0.72rem; }
    .ss-lb-name-text  { font-size: 0.78rem; }
    .ss-lb-cell--time { font-size: 0.78rem; }
    .ss-lb-row        { margin-bottom: 4px; border-radius: 8px; }
    .ss-lb-body-wrap  { height: calc(100vh - 120px); }

    /* nav ultra-compact */
    .ss-lb-nav           { padding: 6px 10px; gap: 8px; margin-top: 2px; margin-bottom: 4px; }
    .ss-lb-nav-btn       { width: 30px; height: 26px; }
    .ss-lb-nav-arrow     { font-size: 0.95rem; }
    .ss-lb-nav-indicator { font-size: 0.75rem; min-width: 56px; }
}