.leaderboard-container {
    max-width: 800px;
    margin: 0 auto;
    padding-top: calc(var(--header-height) + 4rem);
}

.category-submission-card {
    border-color: rgba(243, 108, 33, 0.25) !important;
    background: var(--bg-card) !important;
}

.category-submission-card select,
.category-submission-card input[type="file"] {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .category-submission-card select,
[data-theme="light"] .category-submission-card input[type="file"] {
    background: hsla(0, 0%, 100%, 0.6);
}

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

.rank-table th,
.rank-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.rank-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
    color: #000;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #e5e7eb, #9ca3af);
    color: #000;
}

.rank-3 {
    background: linear-gradient(135deg, #d97706, #78350f);
    color: #fff;
}

tr.current-user {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--primary);
}

/* Filter Buttons CSS */
.filter-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(243, 108, 33, 0.4);
    transform: translateY(-1px);
}

.filter-btn.active:hover {
    box-shadow: 0 6px 20px rgba(243, 108, 33, 0.5);
}

.filter-btn i {
    font-size: 1.1rem;
}

/* Hero Stats Section */
.user-hero-stats {
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.hero-stat-card {
    background: linear-gradient(135deg, rgba(232, 80, 18, 0.2), rgba(251, 170, 40, 0.15));
    background-color: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.5s ease-out;
}

[data-theme=light] .hero-stat-card {
    background: linear-gradient(135deg, rgba(232, 80, 18, 0.12), rgba(251, 170, 40, 0.1));
    background-color: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.hero-stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.hero-stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-profile-card {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 2rem;
    text-align: left;
}

/* ═══════════════════════════════════════════════
   STREAK FIRE BUTTON — number INSIDE the flame
   ═══════════════════════════════════════════════ */
.streak-fire-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 0.5rem;
    transition: transform 0.18s ease;
    font-family: inherit;
}

.streak-fire-btn:hover {
    transform: scale(1.12);
}

/* Wrapper that stacks the number on top of the flame */
.fire-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
}

.fire-badge i {
    font-size: 2.4rem;
    color: #E85012;
    filter: drop-shadow(0 0 5px rgba(232, 80, 18, 0.6));
    transition: filter 0.2s ease, color 0.2s ease;
    line-height: 1;
}

.streak-fire-btn:hover .fire-badge i {
    color: #FBAA28;
    filter: drop-shadow(0 0 10px rgba(251, 170, 40, 0.85));
}

/* Number overlaid at the bottom-centre of the flame */
.fire-number {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.62rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    line-height: 1;
    letter-spacing: -0.02em;
    pointer-events: none;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   STREAK MODAL OVERLAY
   ═══════════════════════════════════════════════ */
.streak-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.streak-modal-overlay.streak-modal-open {
    opacity: 1;
}

.streak-modal-overlay.streak-modal-closing {
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════
   STREAK MODAL CARD
   ═══════════════════════════════════════════════ */
.streak-modal-card {
    background: rgba(8, 8, 8, 0.95);
    border: 1px solid rgba(232, 80, 18, 0.28);
    border-radius: 1.25rem;
    padding: 1.75rem;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(232, 80, 18, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.streak-modal-overlay.streak-modal-open .streak-modal-card {
    transform: translateY(0) scale(1);
}

/* ---- Header ---- */
.streak-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
}

.streak-modal-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    min-width: 0;
    overflow: hidden;
}

.streak-modal-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Flickering fire animation */
.streak-fire-anim {
    color: #E85012;
    font-size: 1.35rem;
    flex-shrink: 0;
    animation: ignitoFireFlicker 1.6s ease-in-out infinite alternate;
}

@keyframes ignitoFireFlicker {
    0%   { transform: scale(1)    rotate(-3deg); filter: drop-shadow(0 0 4px rgba(232, 80,  18, 0.6)); color: #E85012; }
    50%  { transform: scale(1.1)  rotate( 0deg); filter: drop-shadow(0 0 10px rgba(251, 170, 40, 0.9)); color: #FBAA28; }
    100% { transform: scale(1.05) rotate( 3deg); filter: drop-shadow(0 0 6px rgba(232, 80,  18, 0.7)); color: #E85012; }
}

.streak-modal-close {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.streak-modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* ---- Stats row ---- */
.streak-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.streak-stat {
    background: rgba(232, 80, 18, 0.06);
    border: 1px solid rgba(232, 80, 18, 0.18);
    border-radius: 0.75rem;
    padding: 0.75rem 0.4rem;
    text-align: center;
}

.streak-stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.streak-stat-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════
   STREAK CALENDAR GRID
   ═══════════════════════════════════════════════ */
.streak-calendar-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sc-day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
    text-align: center;
}

.sc-day-headers span {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 0;
    letter-spacing: 0.03em;
}

.sc-month-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #E85012;
    margin: 0.8rem 0 0.35rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sc-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}

.sc-day {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 500;
    min-width: 44px;
    min-height: 44px;
    position: relative;
    transition: transform 0.15s ease;
    cursor: default;
}

.sc-day:hover {
    transform: scale(1.12);
    z-index: 1;
}

/* Active day — Ignito gradient */
.sc-day-active {
    background: linear-gradient(135deg, #E85012, #FBAA28);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(232, 80, 18, 0.4);
    flex-direction: column;
    gap: 0px;
}

.sc-day-active > span {
    font-size: 0.55rem;
    opacity: 0.85;
}

/* Sport icon inside active day cell */
.sc-day-active .sc-day-icon {
    font-size: 22px !important;
    line-height: 1 !important;
    opacity: 1;
    display: block !important;
    width: 22px;
    height: 22px;
    text-align: center;
}

/* Inactive event day */
.sc-day-inactive {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.35);
}

/* Outside event range */
.sc-day-out {
    background: transparent;
    color: rgba(255, 255, 255, 0.08);
}

/* Today highlight ring */
.sc-day-today {
    box-shadow: 0 0 0 2px #FBAA28, 0 2px 8px rgba(251, 170, 40, 0.3) !important;
}

/* Loading / empty / error states */
.sc-loading,
.sc-empty,
.sc-error {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sc-error {
    color: #ef4444;
}

/* ═══════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   ═══════════════════════════════════════════════ */
[data-theme=light] .streak-modal-card {
    background: rgba(15, 15, 15, 0.97);
}

[data-theme=light] .streak-stat {
    background: rgba(232, 80, 18, 0.1);
    border-color: rgba(232, 80, 18, 0.25);
}

[data-theme=light] .streak-stat-label {
    color: #9ca3af;
}

[data-theme=light] .sc-day-inactive {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
}

[data-theme=light] .sc-day-out {
    color: rgba(255, 255, 255, 0.1);
}

[data-theme=light] .sc-day-headers span {
    color: #9ca3af;
}

/* Fire button stays readable on light table background */
[data-theme=light] .streak-fire-btn:hover {
    background: rgba(232, 80, 18, 0.08);
    border-radius: 0.5rem;
}

/* ═══════════════════════════════════════════════
   LIGHT THEME — CURRENT-USER ROW HIGHLIGHT
   The dark-mode rule uses rgba(var(--primary-rgb), 0.1) but --primary-rgb is
   not defined, so the tinted background is transparent in both themes. In dark
   mode the orange border is still enough to identify the row; in light mode
   the white card background makes the row completely invisible. These overrides
   supply a hardcoded orange tint so the highlight is visible in light mode.
   ═══════════════════════════════════════════════ */
[data-theme=light] tr.current-user {
    background: rgba(232, 80, 18, 0.08) !important;
    border: 1px solid rgba(232, 80, 18, 0.45);
}

[data-theme=light] #stickyMyRow tr.current-user {
    background: rgba(232, 80, 18, 0.08) !important;
}

[data-theme=light] #stickyMyRowFoot tr.current-user {
    background: rgba(232, 80, 18, 0.08) !important;
}

/* Light-theme sticky bar containers — both are hardcoded rgba(10,10,10,0.96)
   which is near-black. On a white page that renders as a dark band across the
   bottom. Switch to frosted white in light mode so the bar reads as part of
   the card, not as a dark intruder. */
[data-theme=light] #stickyMyRow,
[data-theme="light"] #stickyMyRow,
html[data-theme=light] #stickyMyRow,
.light #stickyMyRow {
    background: rgba(255, 255, 255, 0.97) !important;
    box-shadow: 0 -2px 0 0 var(--primary), 0 -4px 24px rgba(0, 0, 0, 0.12) !important;
}

[data-theme=light] #stickyMyRowFoot,
[data-theme="light"] #stickyMyRowFoot,
html[data-theme=light] #stickyMyRowFoot,
.light #stickyMyRowFoot {
    background: rgba(255, 255, 255, 0.97) !important;
    box-shadow: 0 -2px 0 0 var(--primary), 0 -4px 24px rgba(0, 0, 0, 0.12) !important;
}

/* Keep all text inside the sticky bars readable on the new light background */
[data-theme=light] #stickyMyRow td,
[data-theme=light] #stickyMyRowFoot td,
[data-theme="light"] #stickyMyRow td,
[data-theme="light"] #stickyMyRowFoot td,
.light #stickyMyRow td,
.light #stickyMyRowFoot td {
    color: var(--text-main) !important;
}

/* ═══════════════════════════════════════════════
   STICKY MY-ROW BAR
   ═══════════════════════════════════════════════ */
#stickyMyRow {
    position: fixed;
    bottom: 0;
    /* left & width are set by JS to match the table card */
    z-index: 1000;
    background: rgba(10, 10, 10, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -2px 0 0 var(--primary), 0 -4px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#stickyMyRow.visible {
    transform: translateY(0);
    pointer-events: auto;
}

.sticky-my-row-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
}

#stickyMyRow .rank-table {
    min-width: unset;
}

#stickyMyRow .rank-table td {
    border-bottom: none;
    padding: 0.65rem 1rem;
}

#stickyMyRow tr.current-user {
    border: none;
    background: transparent;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .leaderboard-container {
        padding-top: calc(var(--header-height) + 1rem);
    }

    .glass-card {
        padding: 1.25rem !important;
    }

    h1.text-gradient {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100% !important;
        min-width: 100% !important;
    }

    .filter-buttons {
        overflow-x: auto;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .hero-profile-card {
        grid-column: span 1;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .hero-stat-value {
        font-size: 2rem;
    }

    .rank-table th,
    .rank-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .rank-table {
        min-width: 500px;
    }

    /* Mobile fire badge */
    .fire-badge { width: 2rem; height: 2rem; }
    .fire-badge i { font-size: 2rem; }
    .fire-number { font-size: 0.55rem; bottom: 2px; }

    /* Mobile streak modal */
    .streak-modal-card {
        padding: 1.25rem;
        max-height: 85vh;
    }

    .streak-stats-row {
        gap: 0.5rem;
    }

    .streak-stat-value {
        font-size: 0.95rem;
    }

    .sc-day {
        min-width: 36px;
        min-height: 36px;
        font-size: 0.58rem;
        border-radius: 4px;
    }

    .sc-day-active .sc-day-icon {
        font-size: 18px !important;
        width: 18px;
        height: 18px;
    }

    .table-container {
        overflow: auto;
        max-height: 55vh;
        margin: 0 -1.25rem;
        width: calc(100% + 2.5rem);
        -webkit-overflow-scrolling: touch;
    }

    /* Hide the desktop fixed sticky bar on mobile */
    #stickyMyRow {
        display: none !important;
    }

    /* Mobile sticky tfoot — sticks to bottom of the scroll container */
    #stickyMyRowFoot {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: rgba(10, 10, 10, 0.96);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: 0 -2px 0 0 var(--primary), 0 -4px 24px rgba(0, 0, 0, 0.5);
    }

    #stickyMyRowFoot tr.current-user {
        background: rgba(var(--primary-rgb), 0.08);
        border: none;
    }

    #stickyMyRowFoot td {
        border-bottom: none;
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }
}
