/* ===================================================================
   RAIKU LEADERBOARD — Design System
   Colors: #000204 (deep black), #FDFDFF (white), #C0FF38 (neon green)
   =================================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #000204;
    --bg-card: #0a0c10;
    --bg-card-hover: #0f1218;
    --bg-surface: #111318;
    --border: rgba(192, 255, 56, 0.08);
    --border-hover: rgba(192, 255, 56, 0.2);
    --text: #FDFDFF;
    --text-secondary: rgba(253, 253, 255, 0.55);
    --text-tertiary: rgba(253, 253, 255, 0.3);
    --accent: #C0FF38;
    --accent-dim: rgba(192, 255, 56, 0.15);
    --accent-glow: rgba(192, 255, 56, 0.4);
    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Ambient Background Effects --- */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(192, 255, 56, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(192, 255, 56, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}

.bg-glow--1 {
    width: 600px;
    height: 600px;
    background: rgba(192, 255, 56, 0.04);
    top: -200px;
    right: -100px;
    animation: float1 20s ease-in-out infinite;
}

.bg-glow--2 {
    width: 500px;
    height: 500px;
    background: rgba(192, 255, 56, 0.03);
    bottom: -150px;
    left: -100px;
    animation: float2 25s ease-in-out infinite;
}

@keyframes float1 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-80px, 60px);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(60px, -80px);
    }
}

/* --- Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 2, 4, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.header__logo-icon {
    height: 28px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.header__logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent), #e0ff80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__logo-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-transform: uppercase;
}

.header__stats {
    display: flex;
    gap: 32px;
}

.header__stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.header__stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.header__stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Hero --- */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 24px 40px;
}

.hero__title {
    font-family: var(--font-display);
    line-height: 1.1;
}

.hero__title-line {
    display: block;
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
}

.hero__title-line--accent {
    background: linear-gradient(135deg, var(--accent), #a8e030, #d4ff6e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(192, 255, 56, 0.15));
}

.hero__subtitle {
    margin-top: 16px;
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero__credit {
    margin-top: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

.hero__credit a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

.hero__credit a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

/* --- Controls --- */
.controls {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 32px;
}

.controls__inner {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* --- Search --- */
.search {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    transition: color 0.3s;
    pointer-events: none;
}

.search__input {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.search__input::placeholder {
    color: var(--text-tertiary);
}

.search__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px rgba(192, 255, 56, 0.05);
    background: var(--bg-surface);
}

.search__input:focus~.search__icon,
.search:hover .search__icon {
    color: var(--accent);
}

.search__clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.search__clear:hover {
    color: var(--text);
    background: rgba(253, 253, 255, 0.08);
}

.search__clear.visible {
    display: flex;
}

/* --- Filters --- */
.filters {
    display: flex;
    gap: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-left: 4px;
}

.select-wrapper {
    position: relative;
}

.filter-select {
    appearance: none;
    height: 48px;
    padding: 0 36px 0 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    min-width: 140px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.filter-select option {
    background: var(--bg-card);
    color: var(--text);
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

/* --- Leaderboard --- */
.leaderboard {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* --- Podium (Top 3) --- */
.podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 48px;
}

.podium__card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 28px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.podium__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.podium__card--1::before {
    background: linear-gradient(90deg, var(--gold), #ffe066);
}

.podium__card--2::before {
    background: linear-gradient(90deg, var(--silver), #e0e0e0);
}

.podium__card--3::before {
    background: linear-gradient(90deg, var(--bronze), #e8a050);
}

.podium__card--1 {
    order: 2;
}

.podium__card--2 {
    order: 1;
}

.podium__card--3 {
    order: 3;
}

.podium__card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(192, 255, 56, 0.03);
}

.podium__card--1:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 215, 0, 0.08);
}

.podium__rank-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

.podium__card--1 .podium__rank-badge {
    background: rgba(255, 215, 0, 0.12);
    color: var(--gold);
}

.podium__card--2 .podium__rank-badge {
    background: rgba(192, 192, 192, 0.12);
    color: var(--silver);
}

.podium__card--3 .podium__rank-badge {
    background: rgba(205, 127, 50, 0.12);
    color: var(--bronze);
}

.podium__avatar-wrap {
    position: relative;
    margin-bottom: 16px;
}

.podium__avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    transition: border-color 0.3s;
}

.podium__card--1 .podium__avatar {
    border-color: rgba(255, 215, 0, 0.3);
    width: 84px;
    height: 84px;
}

.podium__card--2 .podium__avatar {
    border-color: rgba(192, 192, 192, 0.3);
}

.podium__card--3 .podium__avatar {
    border-color: rgba(205, 127, 50, 0.3);
}

.podium__crown {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.podium__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
    text-align: center;
    margin-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium__tag {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.podium__messages {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.podium__card--1 .podium__messages {
    font-size: 34px;
}

.podium__messages-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Table --- */
.table-wrapper {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-card);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table__th {
    text-align: left;
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: rgba(192, 255, 56, 0.02);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table__th--rank {
    width: 60px;
    text-align: center;
}

.table__th--messages {
    width: 140px;
    text-align: right;
}

.table__th--channels {
    width: 240px;
    text-align: right;
}

.table__tr {
    border-bottom: 1px solid rgba(192, 255, 56, 0.04);
    transition: background 0.2s;
    cursor: default;
}

.table__tr:last-child {
    border-bottom: none;
}

.table__tr:hover {
    background: rgba(192, 255, 56, 0.02);
}

.table__td {
    padding: 12px 20px;
    vertical-align: middle;
}

.table__td--rank {
    text-align: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-tertiary);
}

.table__td--rank .rank-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
}

.rank-top--4,
.rank-top--5 {
    background: var(--accent-dim);
    color: var(--accent);
}

.table__user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.table__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: border-color 0.3s;
}

.table__tr:hover .table__avatar {
    border-color: var(--border-hover);
}

.table__user-info {
    min-width: 0;
}

.table__username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    display: block;
}

.table__usertag {
    font-size: 12px;
    color: var(--text-tertiary);
}

.table__td--messages {
    text-align: right;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.table__td--channels {
    text-align: right;
}

.channel-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.channel-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(192, 255, 56, 0.06);
    color: var(--text-secondary);
    white-space: nowrap;
    border: 1px solid rgba(192, 255, 56, 0.06);
    transition: background 0.2s, border-color 0.2s;
}

.channel-pill:hover {
    background: var(--accent-dim);
    border-color: var(--border-hover);
    color: var(--accent);
}

.channel-pill__count {
    font-weight: 600;
    color: var(--accent);
    margin-left: 4px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    user-select: none;
}

.pagination__btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--bg-surface);
}

.pagination__btn--active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

.pagination__btn--active:hover {
    background: #d0ff58;
    border-color: #d0ff58;
    color: var(--bg);
}

.pagination__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination__ellipsis {
    color: var(--text-tertiary);
    font-size: 14px;
    padding: 0 4px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-state__icon {
    width: 56px;
    height: 56px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.empty-state__text {
    font-size: 15px;
    color: var(--text-secondary);
}

/* --- Footer --- */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
}

.footer__text {
    font-size: 12px;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

/* --- Loading skeleton --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-surface) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(192, 255, 56, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(192, 255, 56, 0.25);
}

/* --- Highlight match --- */
.highlight {
    background: rgba(192, 255, 56, 0.2);
    color: var(--accent);
    border-radius: 2px;
    padding: 0 1px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .podium {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .podium__card--1,
    .podium__card--2,
    .podium__card--3 {
        order: unset;
    }

    .podium__card {
        flex-direction: row;
        padding: 20px;
        gap: 16px;
        text-align: left;
    }

    .podium__avatar-wrap {
        margin-bottom: 0;
    }

    .podium__name {
        text-align: left;
    }

    .podium__messages {
        font-size: 22px !important;
    }

    .podium__card--1 .podium__avatar {
        width: 60px;
        height: 60px;
    }

    .podium__crown {
        top: -10px;
        font-size: 16px;
    }

    .podium__rank-badge {
        top: 12px;
        right: 12px;
    }

    .podium__messages-label {
        display: none;
    }

    .table__th--channels,
    .table__td--channels {
        display: none;
    }

    .header__stats {
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 56px 20px 28px;
    }

    .controls__inner {
        flex-direction: column;
    }

    .search {
        min-width: unset;
    }

    .filters {
        width: 100%;
    }

    .filter-group {
        flex: 1;
    }

    .filter-select {
        width: 100%;
    }

    .header__inner {
        padding: 0 16px;
    }

    .header__logo-badge {
        display: none;
    }

    .leaderboard {
        padding: 0 16px 60px;
    }

    .controls {
        padding: 0 16px 24px;
    }

    .table__td {
        padding: 10px 12px;
    }

    .table__th {
        padding: 12px;
    }

    .table__username {
        max-width: 150px;
    }

    .table__avatar {
        width: 32px;
        height: 32px;
    }

    .table__user {
        gap: 10px;
    }
}