/* Embed leaderboard — skeletons, pill popups, scroll fade */

/* —— embedLeaderboard.hbs shell: 525×972 viewport, centered on larger screens —— */
html {
    min-height: 100vh;
    background: #1a1a1a;
}

body.embedleaderboard-page {
    margin: 0 auto;
    padding: 0;
    width: 525px;
    height: 972px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}

.embedleaderboard {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #0B1425;
    color: #e0e0e0;
    font-family: "Metropolis Regular";
    padding: 16px 16px 0 16px;
    position: relative;
}

.embedleaderboard-main.hide,
.embedleaderboard-skeleton-layer.hide {
    display: none !important;
}

/* —— Static header: title always visible + game-mode slot (skeleton then pill) —— */
.embedleaderboard-static-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.embedleaderboard-header-game-slot {
    margin-left: auto;
    flex-shrink: 0;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.embedleaderboard-skel-game-pill {
    height: 36px;
    min-width: 120px;
    max-width: 200px;
    width: 140px;
    border-radius: 999px;
    background: linear-gradient(90deg, #243447 0%, #2d4a6a 50%, #243447 100%);
    background-size: 200% 100%;
    animation: embedleaderboard-skeleton-shine 1.2s ease-in-out infinite;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

/* —— Skeleton layer (filters + list only; title is always real) —— */
.embedleaderboard-skeleton-layer {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.embedleaderboard-params-label-static {
    flex-shrink: 0;
    margin-bottom: 8px;
}

.embedleaderboard-skel-pill-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.embedleaderboard-skel-pill {
    height: 36px;
    width: 100px;
    border-radius: 999px;
    background: linear-gradient(90deg, #243447 0%, #2d4a6a 50%, #243447 100%);
    background-size: 200% 100%;
    animation: embedleaderboard-skeleton-shine 1.2s ease-in-out infinite;
}

.embedleaderboard-skel-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.embedleaderboard-skel-line {
    height: 70px;
    border-radius: 8px;
    background: linear-gradient(90deg, #243447 0%, #2d4a6a 50%, #243447 100%);
    background-size: 200% 100%;
    animation: embedleaderboard-skeleton-shine 1.2s ease-in-out infinite;
}

@keyframes embedleaderboard-skeleton-shine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* —— Main layout: takes remaining viewport height so list can overflow-y auto —— */
.embedleaderboard-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.embedleaderboard-title {
    font-family: "Metropolis Semi Bold";
    font-size: 22px;
    color: #fff;
}

.embedleaderboard-game-wrap.hide {
    display: none;
}

.embedleaderboard-game-wrap {
    flex-shrink: 0;
}

/* —— Pill + popup —— */
.embedleaderboard-pill-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.embedleaderboard-pill-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 28px;
    font-family: "Metropolis Semi Bold";
    border: 1px solid #fff;
    cursor: pointer;
    min-width: 0;
    max-width: 305px;
    outline: none !important;
}

.embedleaderboard-pill-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    color: #fff;
    font-family: "Metropolis Semi Bold";
    font-size: 18px;
}

.embedleaderboard-pill-trigger:hover .embedleaderboard-pill-trigger-text,
.embedleaderboard-pill-trigger:focus .embedleaderboard-pill-trigger-text,
.embedleaderboard-pill-trigger:active .embedleaderboard-pill-trigger-text,
.embedleaderboard-pill-trigger-open .embedleaderboard-pill-trigger-text {
    color: #1683ff;
}

.embedleaderboard-pill-trigger:hover,
.embedleaderboard-pill-trigger:focus,
.embedleaderboard-pill-trigger:active,
.embedleaderboard-pill-trigger-open {
    color: #1683ff;
    border-color: #1683ff;
}

.embedleaderboard-pill-trigger:focus,
.embedleaderboard-pill-trigger:focus-visible,
.embedleaderboard-pill-trigger:active {
    outline: none !important;
}

.embedleaderboard-filters .embedleaderboard-pill-wrap {
    margin-right: 4px;
    margin-bottom: 6px;
}

.embedleaderboard-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    max-width: min(280px, 85vw);
    z-index: 50;
    border-radius: 12px;
    border: 1px solid #1683ff;
    background: #1a2332;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    padding: 0;
    overflow: hidden;
}

/* Game mode pill sits on the right; open popup leftward so it stays in view */
.embedleaderboard-popup--align-end {
    left: auto;
    right: 0;
}

.embedleaderboard-popup.hide {
    display: none;
}

.embedleaderboard-popup-scroll {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.embedleaderboard-popup-scroll::-webkit-scrollbar {
    display: none;
}

.embedleaderboard-popup-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 14px;
    font-family: "Metropolis Regular";
    text-align: left;
    cursor: pointer;
    gap: 10px;
}

.embedleaderboard-popup-item:first-child {
    border-radius: 11px 11px 0 0;
}

.embedleaderboard-popup-item:last-child {
    border-bottom: none;
    border-radius: 0 0 11px 11px;
}

.embedleaderboard-popup-item:hover {
    background: #1683ff !important;
    color: #fff !important;
}

.embedleaderboard-popup-item-selected {
    background: #1683ff !important;
    color: #fff !important;
    font-family: "Metropolis Semi Bold";
    border-bottom: none;
}

.embedleaderboard-popup-item-selected:hover {
    background: #1683ff !important;
}

.embedleaderboard-popup-item-text {
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    color: inherit;
    font-family: "Metropolis Regular";
}

.embedleaderboard-popup-item-selected .embedleaderboard-popup-item-text {
    font-family: "Metropolis Semi Bold";
}

.embedleaderboard-popup-item:hover .embedleaderboard-popup-item-text {
    color: inherit;
}

.embedleaderboard-popup-check {
    flex-shrink: 0;
    margin-top: 2px;
    width: 20px;
    height: 20px;
    display: inline-block;
    background: url("https://d1gq9jzbezk7fw.cloudfront.net/p/en_US/gv/i/check_icon_white_bike.png")
        center/contain no-repeat;
}

/* Scroll fade: only when content overflows and not scrolled to bottom (at-bottom class set by JS) */
.embedleaderboard-popup-scroll.embedleaderboard-scroll-fade:not(
        .embedleaderboard-scroll-at-bottom
    ) {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 50px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 50px), transparent 100%);
}

.embedleaderboard-list-scroll.embedleaderboard-scroll-fade:not(.embedleaderboard-scroll-at-bottom) {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 70px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 70px), transparent 100%);
}

.embedleaderboard-list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.embedleaderboard-list-scroll::-webkit-scrollbar {
    display: none;
}

.embedleaderboard-list-scroll.embedleaderboard-list-loading {
    opacity: 0.5;
    pointer-events: none;
}

.embedleaderboard-list {
    padding-block: 12px 8px;
}

.embedleaderboard-params {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.embedleaderboard-params-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 8px;
}

.embedleaderboard-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.embedleaderboard-user-message {
    flex-shrink: 0;
    color: #1683ff;
    margin-bottom: 10px;
    font-family: "Metropolis Semi Bold";
    font-size: 18px;
    line-height: 24px;
}

.embedleaderboard-user-message.hide {
    display: none;
}

.embedleaderboard-empty {
    flex-shrink: 0;
    padding: 150px 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 18px;
    line-height: 20px;
    font-family: "Metropolis Regular";
}

.embedleaderboard-empty.hide {
    display: none;
}

.embedleaderboard-list-outer {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.embedleaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #2d3e50;
    gap: 12px;
    color: #fff;
    font-size: 20px;
    font-family: "Metropolis Regular";
}

.embedleaderboard-row-me {
    background: rgba(22, 131, 255, 0.5);
    font-family: "Metropolis Semi Bold";
}

.embedleaderboard-rank {
    flex-shrink: 0;
    width: 36px;
    color: #fff;
    font-size: 20px;
    font-family: inherit;
}

.embedleaderboard-row-me .embedleaderboard-rank {
    font-family: "Metropolis Semi Bold";
}

.embedleaderboard-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.embedleaderboard-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.embedleaderboard-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #243447;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #7dd3fc;
    flex-shrink: 0;
}

.embedleaderboard-name {
    font-size: 20px;
    color: #fff;
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embedleaderboard-row-me .embedleaderboard-name {
    font-family: "Metropolis Semi Bold";
}

.embedleaderboard-metric {
    flex-shrink: 0;
    color: #fff;
    font-size: 20px;
    font-family: inherit;
}

.embedleaderboard-row-me .embedleaderboard-metric {
    font-family: "Metropolis Semi Bold";
}

/* —— Road Details: layout + ghost module + row icons —— */
/*
 * Extra chrome (ghost module) sits above the list; constrain the flex chain so
 * list-scroll keeps a bounded height and can scroll through all rows.
 */
.embedleaderboard--roads {
    min-height: 0;
    overflow: hidden;
}

.embedleaderboard--roads .embedleaderboard-main {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.embedleaderboard--roads .embedleaderboard-params,
.embedleaderboard--roads .embedleaderboard-user-message,
.embedleaderboard--roads .embedleaderboard-ghost-slot,
.embedleaderboard--roads .embedleaderboard-empty {
    flex-shrink: 0;
}

.embedleaderboard--roads .embedleaderboard-list-outer {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.embedleaderboard--roads .embedleaderboard-list-scroll {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    overflow-y: auto;
}

.embedleaderboard--roads .embedleaderboard-list {
    padding-bottom: 24px;
}

.embedleaderboard-ghost-slot.hide {
    display: none;
}

.embedleaderboard-ghost-module {
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(36, 52, 71, 0.85);
    margin-bottom: 12px;
    padding: 14px 16px;
}

.embedleaderboard-ghost-choose {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.embedleaderboard-ghost-choose-art {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.embedleaderboard-ghost-choose-title {
    color: #1683ff;
    font-family: "Metropolis Semi Bold";
    font-size: 18px;
    line-height: 24px;
}

.embedleaderboard-ghost-choose-body {
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    line-height: 22px;
}

.embedleaderboard-ghost-competing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.embedleaderboard-ghost-competing-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.embedleaderboard-ghost-module-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.embedleaderboard-ghost-competing-title {
    color: #1683ff;
    font-family: "Metropolis Semi Bold";
    font-size: 18px;
    line-height: 24px;
}

.embedleaderboard-ghost-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

.embedleaderboard-ghost-clear:hover,
.embedleaderboard-ghost-clear:focus,
.embedleaderboard-ghost-clear:focus-visible,
.embedleaderboard-ghost-clear:active {
    outline: none !important;
    box-shadow: none;
    background: transparent;
    color: #fff;
}

.embedleaderboard-ghost-competing-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.embedleaderboard-ghost-avatar,
.embedleaderboard-ghost-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.embedleaderboard-ghost-avatar {
    object-fit: cover;
}

.embedleaderboard-ghost-avatar-placeholder {
    background: #243447;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #7dd3fc;
}

.embedleaderboard-ghost-competing-name {
    flex: 1;
    min-width: 0;
    color: #fff;
    font-family: "Metropolis Semi Bold";
    font-size: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embedleaderboard-ghost-competing-time {
    flex-shrink: 0;
    color: #fff;
    font-size: 18px;
    font-family: "Metropolis Regular";
}

.embedleaderboard-ghost-error-text {
    color: #f87171;
    font-size: 16px;
    line-height: 22px;
}

.embedleaderboard-metric-cell {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.embedleaderboard-ghost-row-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

.embedleaderboard-ghost-row-btn:hover,
.embedleaderboard-ghost-row-btn:focus,
.embedleaderboard-ghost-row-btn:focus-visible,
.embedleaderboard-ghost-row-btn:active {
    outline: none !important;
    box-shadow: none;
    background: transparent;
    border: none;
}

.embedleaderboard-ghost-row-btn-active {
    cursor: default;
    pointer-events: none;
}

.embedleaderboard-ghost-row-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}
