/* Rank Progression component styles for the public support site.
   Keep rank-specific presentation here; JS should only render stateful markup and events. */

.rank-list,
.rank-item {
    min-width: 0;
}

.rank-item {
    position: relative;
}

.rank-list.rank-progression-enhanced {
    display: grid;
    gap: 12px;
}

.rank-item span {
    overflow-wrap: anywhere;
}

.rank-badge-img,
.compact-rank-badge,
.metric-rank-badge,
.rank-status-badge,
.rank-title-badge,
.rank-toast-badge,
.sticky-rank-badge,
.sticky-selected-rank-badge,
.sticky-result-rank-badge,
.leaderboard-row-rank-badge {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    line-height: 1;
    border: 1px solid rgba(126, 223, 255, 0.34);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(126, 223, 255, 0.11), rgba(8, 24, 45, 0.60));
    box-shadow: inset 0 0 12px rgba(126, 223, 255, 0.05), 0 0 10px rgba(35, 180, 255, 0.08);
}

.rank-badge-img img,
.compact-rank-badge img,
.metric-rank-badge img,
.rank-status-badge img,
.rank-title-badge img,
.rank-toast-badge img,
.sticky-rank-badge img,
.sticky-selected-rank-badge img,
.sticky-result-rank-badge img,
.leaderboard-row-rank-badge img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: block;
    object-fit: contain;
}

.rank-badge-img.placeholder,
.compact-rank-badge.placeholder,
.metric-rank-badge.placeholder,
.rank-status-badge.placeholder,
.rank-title-badge.placeholder,
.rank-toast-badge.placeholder,
.sticky-rank-badge.placeholder,
.sticky-selected-rank-badge.placeholder,
.sticky-result-rank-badge.placeholder,
.leaderboard-row-rank-badge.placeholder {
    color: rgba(234, 247, 255, 0.82);
    font-weight: 1000;
}

.rank-progress-summary {
    position: relative;
    overflow: hidden;
    padding: 14px;
    border: 1px solid rgba(176, 154, 255, 0.56);
    border-radius: 17px;
    background:
        radial-gradient(circle at 10% 0%, rgba(176, 154, 255, 0.20), transparent 34%),
        radial-gradient(circle at 88% 6%, rgba(126, 223, 255, 0.11), transparent 34%),
        linear-gradient(135deg, rgba(176, 154, 255, 0.15), rgba(8, 24, 45, 0.84) 42%, rgba(5, 15, 31, 0.84));
    box-shadow: 0 0 30px rgba(176, 154, 255, 0.17), inset 0 0 24px rgba(176, 154, 255, 0.055), inset 0 1px 0 rgba(234, 247, 255, 0.06);
}

.rank-progress-summary::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent, rgba(176, 154, 255, 0.13), rgba(126, 223, 255, 0.08), transparent),
        linear-gradient(180deg, rgba(234, 247, 255, 0.045), transparent 44%);
    opacity: 0.82;
}

.rank-status-card {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.rank-status-primary {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.rank-status-badge {
    width: 54px;
    height: 54px;
    padding: 4px;
    border-color: rgba(176, 154, 255, 0.54);
    border-radius: 14px;
    background: radial-gradient(circle at 50% 36%, rgba(176, 154, 255, 0.18), transparent 66%), rgba(176, 154, 255, 0.075);
    box-shadow: inset 0 0 16px rgba(176, 154, 255, 0.08), 0 0 16px rgba(176, 154, 255, 0.16);
    filter: drop-shadow(0 0 12px rgba(176, 154, 255, 0.22));
}

.rank-status-badge.next {
    width: 54px;
    height: 54px;
    justify-self: end;
    border-color: rgba(176, 154, 255, 0.48);
    filter: drop-shadow(0 0 10px rgba(176, 154, 255, 0.18));
}

.rank-title-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(126, 223, 255, 0.42);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(126, 223, 255, 0.16), rgba(126, 223, 255, 0.04));
    color: rgba(234, 247, 255, 0.92);
    font-size: 20px;
    font-weight: 1000;
    box-shadow: inset 0 0 18px rgba(126, 223, 255, 0.07);
}

.rank-title-icon.next {
    border-color: rgba(176, 154, 255, 0.46);
    background: linear-gradient(135deg, rgba(176, 154, 255, 0.16), rgba(176, 154, 255, 0.045));
    color: #d8ceff;
}

.rank-title-icon.small,
.rank-title-badge.small {
    width: 28px;
    height: 28px;
    padding: 2px;
    border-radius: 9px;
    font-size: 12px;
    box-shadow: none;
}

.rank-status-kicker,
.rank-status-label {
    color: #d8ceff;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.14em;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(176, 154, 255, 0.16);
    text-transform: uppercase;
}

.rank-status-title {
    margin-top: 3px;
    color: var(--text);
    font-size: clamp(22px, 2.4vw, 34px);
    font-weight: 1000;
    letter-spacing: -0.04em;
    line-height: 0.98;
    text-shadow: 0 0 14px rgba(176, 154, 255, 0.12);
}

.rank-status-sub,
.rank-status-next-sub {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.rank-status-sub strong,
.rank-status-next-sub strong {
    color: var(--text);
    font-weight: 1000;
}

.rank-status-next {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 12px;
    align-items: center;
    justify-self: end;
    min-width: 0;
    text-align: right;
}

.rank-status-next-value {
    margin-top: 3px;
    color: #d8ceff;
    font-size: clamp(20px, 2vw, 28px);
    font-weight: 1000;
    letter-spacing: -0.035em;
    line-height: 0.98;
    text-shadow: 0 0 14px rgba(176, 154, 255, 0.20);
}

.rank-progress-summary-pill {
    align-self: center;
    justify-self: center;
    border: 1px solid rgba(176, 154, 255, 0.58);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(176, 154, 255, 0.18), rgba(8, 24, 45, 0.58));
    color: #e3dcff;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    padding: 6px 10px;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 0 14px rgba(176, 154, 255, 0.12), inset 0 0 12px rgba(176, 154, 255, 0.045);
}

.rank-status-progress {
    grid-column: 1 / -1;
    margin-top: 3px;
}

.rank-progression-row {
    position: relative;
    overflow: hidden;
    padding: 10px 12px;
    border: 1px solid rgba(93, 210, 255, 0.2);
    border-radius: 14px;
    background: rgba(8, 24, 45, 0.62);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.rank-progression-row:hover {
    transform: translateY(-1px);
    border-color: rgba(126, 223, 255, 0.36);
    background: rgba(11, 32, 58, 0.72);
}

.rank-progression-row.current-title {
    border-color: rgba(176, 154, 255, 0.74);
    background:
        radial-gradient(circle at 8% 0%, rgba(176, 154, 255, 0.16), transparent 34%),
        linear-gradient(135deg, rgba(176, 154, 255, 0.12), rgba(18, 51, 84, 0.82) 44%, rgba(8, 24, 45, 0.78));
    box-shadow: inset 4px 0 0 rgba(176, 154, 255, 0.52), 0 0 22px rgba(176, 154, 255, 0.18), inset 0 1px 0 rgba(234, 247, 255, 0.045);
}

.rank-progression-row.current-title:hover {
    border-color: rgba(176, 154, 255, 0.88);
    box-shadow: inset 4px 0 0 rgba(176, 154, 255, 0.64), 0 0 26px rgba(176, 154, 255, 0.22), inset 0 1px 0 rgba(234, 247, 255, 0.055);
}

.rank-progression-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    z-index: 1;
}

.rank-progression-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.rank-progression-title {
    font-weight: 900;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-progression-row.current-title .rank-progression-title {
    color: #e3dcff;
    text-shadow: 0 0 10px rgba(176, 154, 255, 0.18);
}

.rank-progression-rank-range {
    justify-self: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.rank-progression-row.current-title .rank-progression-rank-range {
    color: rgba(216, 206, 255, 0.78);
}

.rank-progression-credit-range {
    justify-self: end;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.rank-progression-row.current-title .rank-progression-credit-range {
    color: rgba(234, 247, 255, 0.70);
}

.rank-chip-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
    gap: 5px;
    margin-bottom: 8px;
}

.rank-chip {
    min-height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(126, 223, 255, 0.16);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.028);
    color: rgba(234, 247, 255, 0.42);
    font-size: 12px;
    font-weight: 900;
}

.rank-chip.unlocked {
    color: var(--text);
    border-color: rgba(129, 255, 195, 0.35);
    background: rgba(129, 255, 195, 0.08);
}

.rank-progression-row.current-title .rank-chip.unlocked {
    border-color: rgba(126, 223, 255, 0.42);
    background: rgba(126, 223, 255, 0.095);
}

.rank-chip.current {
    color: #ffffff;
    border-color: rgba(176, 154, 255, 0.95);
    background: linear-gradient(135deg, rgba(176, 154, 255, 0.34), rgba(126, 223, 255, 0.16));
    box-shadow: 0 0 16px rgba(176, 154, 255, 0.30), inset 0 0 12px rgba(176, 154, 255, 0.08);
}

.rank-chip.next {
    color: #d8ceff;
    border-color: rgba(176, 154, 255, 0.58);
    background: rgba(176, 154, 255, 0.12);
    box-shadow: 0 0 12px rgba(176, 154, 255, 0.14);
}

.rank-progress-track {
    position: relative;
    z-index: 1;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.rank-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #36bfff, #7effe8);
    transition: width 520ms ease;
}

.rank-progression-row.current-title .rank-progress-track,
.rank-progress-summary .rank-progress-track {
    background: rgba(176, 154, 255, 0.13);
    box-shadow: inset 0 0 0 1px rgba(176, 154, 255, 0.10);
}

.rank-progress-meta {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.rank-progress-meta strong {
    justify-self: end;
    color: var(--accent);
}

.rank-active-marker {
    justify-self: center;
    color: rgba(176, 154, 255, 0.78);
    font-size: 11px;
    font-weight: 1000;
    letter-spacing: 0.16em;
    text-shadow: 0 0 10px rgba(176, 154, 255, 0.18);
    text-transform: uppercase;
}

.rank-active-marker.empty {
    opacity: 0;
}

.rank-toast {
    position: fixed;
    z-index: 10021;
    right: 24px;
    top: 112px;
    width: min(390px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(176, 154, 255, 0.78);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(10, 24, 42, 0.98), rgba(24, 20, 52, 0.96));
    box-shadow: 0 0 36px rgba(176, 154, 255, 0.30), 0 18px 36px rgba(0, 0, 0, 0.45);
    transform: translateY(-10px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    animation: rankToastIn 520ms ease-out forwards, rankToastOut 520ms ease-in 7.6s forwards;
}

.rank-toast::before {
    content: "";
    position: absolute;
    inset: -70% -30%;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.18) 48%, transparent 60%);
    transform: translateX(-45%);
    animation: rankToastSweep 1.6s ease-out 220ms;
    pointer-events: none;
}

.rank-toast-icon {
    position: relative;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid rgba(176, 154, 255, 0.58);
    background: rgba(176, 154, 255, 0.12);
    color: #d8ceff;
    font-size: 24px;
    font-weight: 1000;
    box-shadow: inset 0 0 20px rgba(176, 154, 255, 0.10), 0 0 14px rgba(176, 154, 255, 0.18);
}

.rank-toast-badge {
    width: 48px;
    height: 48px;
    padding: 4px;
    border-radius: 13px;
}

.compact-rank-badge {
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 2px;
    border-radius: 8px;
}

.metric-rank-badge {
    width: 28px;
    height: 28px;
    margin-right: 7px;
    padding: 2px;
    border-radius: 9px;
    vertical-align: middle;
}

.rank-next-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sticky-rank-badge,
.sticky-selected-rank-badge,
.sticky-result-rank-badge,
.leaderboard-row-rank-badge {
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 2px;
    border-radius: 7px;
}

.sticky-hud-value.has-rank-badge,
.sticky-result-rank-pill.has-rank-badge,
.leaderboard-rank-title.has-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#sticky-selected-viewer .sticky-selected-left {
    align-items: center;
    gap: 6px;
}

.rank-toast-copy {
    position: relative;
    min-width: 0;
}

.rank-toast-kicker {
    color: #d8ceff;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rank-toast-title {
    margin-top: 3px;
    color: var(--text);
    font-size: 19px;
    font-weight: 950;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-toast-sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
}

.sticky-hud-pill.rank-changed {
    border-color: rgba(176, 154, 255, 0.86) !important;
    background: linear-gradient(135deg, rgba(176, 154, 255, 0.16), rgba(18, 51, 84, 0.86)) !important;
    box-shadow: 0 0 26px rgba(176, 154, 255, 0.24), inset 0 0 22px rgba(176, 154, 255, 0.08) !important;
    animation: stickyRankPulse 1.2s ease-out 2;
    overflow: hidden;
    position: relative;
}

.sticky-hud-pill.rank-changed::before {
    content: "";
    position: absolute;
    inset: -70% -30%;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 48%, transparent 60%);
    transform: translateX(-40%);
    animation: stickyRankSweep 1.5s ease-out;
    pointer-events: none;
}

.sticky-selected-viewer.viewer-selected-changed {
    border-color: rgba(126, 223, 255, 0.84) !important;
    background: linear-gradient(135deg, rgba(18, 51, 84, 0.92), rgba(8, 24, 45, 0.98)) !important;
    box-shadow: 0 0 24px rgba(55, 187, 255, 0.22), inset 3px 0 0 rgba(129, 255, 195, 0.70), inset 0 0 20px rgba(126, 223, 255, 0.06) !important;
    animation: stickySelectedViewerPulse 1.15s ease-out 2;
    overflow: hidden;
}

.sticky-selected-viewer.viewer-selected-changed::before {
    content: "";
    position: absolute;
    inset: -70% -30%;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 48%, transparent 60%);
    transform: translateX(-40%);
    animation: stickySelectedViewerSweep 1.45s ease-out;
    pointer-events: none;
}

@media (max-width: 760px),
       (min-width: 761px) and (max-width: 1180px) and (orientation: portrait) {
    .rank-progress-summary {
        padding: 10px;
        border-radius: 14px;
    }

    .rank-status-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .rank-status-primary,
    .rank-status-next {
        gap: 8px;
        justify-self: stretch;
        text-align: left;
    }

    .rank-status-primary {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .rank-status-next {
        direction: ltr;
        grid-template-columns: minmax(0, 1fr) 34px;
        align-items: center;
        padding: 8px;
        border: 1px solid rgba(176, 154, 255, 0.24);
        border-radius: 12px;
        background: rgba(176, 154, 255, 0.055);
    }

    .rank-status-next > * {
        direction: ltr;
    }

    .rank-status-badge {
        width: 40px;
        height: 40px;
        padding: 3px;
        border-radius: 11px;
        justify-self: start;
    }

    .rank-status-badge.next {
        width: 34px;
        height: 34px;
        padding: 2px;
        border-radius: 10px;
        justify-self: end;
    }

    .rank-status-kicker,
    .rank-status-label {
        font-size: 9px;
        letter-spacing: 0.11em;
    }

    .rank-status-title {
        font-size: clamp(20px, 6vw, 27px);
    }

    .rank-status-next-value {
        font-size: clamp(17px, 5vw, 22px);
        line-height: 1.02;
        max-width: 100%;
    }

    .rank-status-sub,
    .rank-status-next-sub {
        margin-top: 3px;
        font-size: 10.5px;
        line-height: 1.22;
    }

    .rank-status-progress {
        margin-top: 0;
    }

    .rank-progress-summary-pill {
        justify-self: start;
        width: fit-content;
        padding: 5px 8px;
        font-size: 9px;
        letter-spacing: 0.06em;
    }

    .rank-progression-row {
        padding: 8px;
        border-radius: 12px;
    }

    .rank-progression-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px;
        margin-bottom: 6px;
    }

    .rank-progression-rank-range {
        justify-self: end;
        font-size: 10px;
    }

    .rank-progression-credit-range {
        grid-column: 1 / -1;
        justify-self: start;
        font-size: 10px;
        text-align: left;
        margin-top: -3px;
    }

    .rank-title-icon.small,
    .rank-title-badge.small {
        width: 22px;
        height: 22px;
        border-radius: 7px;
    }

    .rank-chip-grid {
        grid-template-columns: repeat(auto-fit, minmax(24px, 1fr));
        gap: 4px;
        margin-bottom: 6px;
    }

    .rank-chip {
        min-height: 22px;
        border-radius: 7px;
        font-size: 10px;
    }

    .rank-progress-track {
        height: 6px;
    }

    .rank-progress-meta {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
        margin-top: 5px;
        font-size: 10px;
    }

    .rank-active-marker {
        display: none;
    }
}

@keyframes rankToastIn {
    0% { opacity: 0; transform: translateY(-10px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rankToastOut {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-8px) scale(0.985); }
}

@keyframes rankToastSweep {
    0% { transform: translateX(-55%); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateX(55%); opacity: 0; }
}

@keyframes stickyRankPulse {
    0% { transform: translateY(0); }
    45% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

@keyframes stickyRankSweep {
    0% { transform: translateX(-50%); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateX(50%); opacity: 0; }
}

@keyframes stickySelectedViewerPulse {
    0% { transform: translateY(0); }
    45% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

@keyframes stickySelectedViewerSweep {
    0% { transform: translateX(-50%); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateX(50%); opacity: 0; }
}
