@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800;900&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {

    /* Themeable accent color (operator-configurable). "r, g, b" channels used
       with rgba(var(--accent-rgb), alpha) throughout the overlay. */
    --accent-rgb: 3, 220, 235;

    --c-gold: #FFD051;
    --c-silver: #9DCADA;
    --c-bronze: #CF897D;
    --c-purple: #3E19E1;
    --c-pink: #C01F64;

    --bg-test: rgba(var(--accent-rgb), 1);

    /* ═══════════════════════════════════════
       🏆 RANK ROW BACKGROUNDS
       ═══════════════════════════════════════ */
    --bg-rank-1: rgba(var(--accent-rgb), 0.15);
    --bg-rank-2: rgba(var(--accent-rgb), 0.15);
    --bg-rank-3: rgba(var(--accent-rgb), 0.15);


    --bg-head-rank-1: rgba(var(--accent-rgb), 0.30);
    --bg-head-rank-2: rgba(var(--accent-rgb), 0.30);
    --bg-head-rank-3: rgba(var(--accent-rgb), 0.30);


    --bg-head-rank-1-pin: rgba(var(--accent-rgb), 0.80);
    --bg-head-rank-2-pin: rgba(var(--accent-rgb), 0.80);
    --bg-head-rank-3-pin: rgba(var(--accent-rgb), 0.80);
    --bg-rank-4-badge-pin: rgba(var(--accent-rgb), 0.80);

    /* single-column container */
    --font-color-single-column: rgba(255, 255, 255, 1);
    --bg-head-single-column: rgba(0, 0, 0, 0.2);
    --bg-body-single-column: rgba(0, 0, 0, 0.4);

    /* ═══════════════════════════════════════
       ✨ ACTIVE BATTLE (hero highlight)
       ═══════════════════════════════════════ */
    --grad-hero: rgba(var(--accent-rgb), 0.50);
    --grad-hero-pin: rgba(var(--accent-rgb), 0.50);


    /* Gold (rank 1) */
    --crown-gold-top: #FFD051;
    --crown-gold-bottom: #E88A1F;
    --crown-gold-stroke: #E8731F;
    /* Silver (rank 2) */
    --crown-silver-top: #9DCADA;
    --crown-silver-bottom: #45859D;
    --crown-silver-stroke: #3285A4;
    /* Bronze (rank 3) */
    --crown-bronze-top: #CF897D;
    --crown-bronze-bottom: #B53E19;
    --crown-bronze-stroke: #A75634;

    /* ═══════════════════════════════════════
       💥 EFFECTS & PARTICLES
       ═══════════════════════════════════════ */
    /* Particle burst dot */
    --particle-color: var(--c-pink);
    --particle-glow: var(--c-purple);
    /* Time-flash overlay tints */
    --flash-60-color: rgba(255, 215, 0, 0.22);
    --flash-30-color: rgba(255, 120, 0, 0.22);
    --flash-10-color: rgba(255, 28, 110, 0.22);
    /* Score pulse highlight */
    --score-pulse-glow-1: rgba(255, 215, 0, 1);
    --score-pulse-glow-2: rgba(255, 140, 0, 1);
    --score-pulse-mid: #FFD051;
    /* Score burst glow strip */
    --score-burst-color: rgba(255, 215, 0, 0.5);
    /* Speed-line (on-fire) tint */
    --speed-line-color: rgba(255, 150, 50, 0.7);
    /* Coin float text */
    --coin-color: #fbbf24;
    /* Suspense reveal glow per rank */
    --reveal-glow-rank1: rgba(255, 215, 0, 0.9);
    --reveal-glow-rank2: rgba(157, 202, 218, 0.6);
    --reveal-glow-rank3: rgba(207, 137, 125, 0.6);
    /* Wave border colors */
    --wave-60-color: rgba(255, 215, 0, 0.5);
    --wave-30-color1: rgba(255, 120, 0, 0.6);
    --wave-10-color1: rgba(155, 45, 255, 0.8);
    --wave-10-color2: rgba(255, 28, 110, 0.8);

    /* ═══════════════════════════════════════
       📐 LAYOUT — Single Column (default)
       ═══════════════════════════════════════ */
    --col-w: 550px;
    --row-h: 130px;
    --avatar-sz: 70px;
    --badge-w: 55px;
    --badge-h: 42px;
    --badge-rail-w: 80px;
    --name-fs: 25px;
    --score-fs: 44px;
    --rank-fs: 30px;
    --out-sz: 75px;
    --row-gap: 8px;
    --row-px: 15px;
    --opacity-out: 0.35;
}


body {
    font-family: 'Noto Sans Thai', sans-serif;
    background: transparent;
    min-height: 100vh;
    padding: 12px;
}

.overlay-debug {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
    padding-left: 4px;
}

.container {
    width: var(--col-w);
    max-width: 2500px;
    max-height: 2000px;
    border-radius: 20px;
    position: relative;
    transition: width 0.6s ease;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/*-----------  Config Header ------------------*/
.test {
    display: none;
    align-items: center;
    padding: 10px 24px 10px 28px;
    background: rgba(85, 85, 95, 0.95);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    margin: 24px 0px 5px 0px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.test::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: var(--bg-test);
}

.container:not(.single-column) .test {
    display: flex;
}

.container:not(.single-column) {
    width: calc((var(--col-count, 1) * var(--col-w)) + ((var(--col-count, 1) - 1) * 14px));
    background: transparent;
    box-shadow: none;
    border: none;
    overflow: visible;
    border-radius: 0;

    --col-w: 380px;
    --row-h: 75px;
    --avatar-sz: 42px;
    --badge-w: 50px;
    --badge-h: 42px;
    --badge-rail-w: 50px;
    --name-fs: 23px;
    --score-fs: 27px;
    --rank-fs: 22px;
    --out-sz: 55px;
    --row-gap: 10px;
    --row-px: 10px;

}

.container:not(.single-column) .ranking-columns {
    gap: 14px;
}

.container:not(.single-column) .ranking-column {
    background: transparent;

    border-radius: 16px;
    border: none;
    overflow: visible;
    transform: translateZ(0);
}

.ranking-header {
    padding: 0 24px;
    height: 90px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid #fff;
    flex-shrink: 0;
}

.ranking-header h1 {
    font-size: 40px;
    font-weight: 800;
    color: #fff;
    line-height: 60px;
    text-shadow: 0 0 8px #000;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}

/* ── Ranking title marquee (activates when text overflows container) ── */
@keyframes marquee-title {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.ranking-title-marquee-track {
    display: inline-flex;
    white-space: nowrap;
}

.ranking-title-marquee-track.title-marquee-anim {
    animation: marquee-title 30s linear infinite;
}

.container:not(.single-column) .ranking-header,
.container:not(.single-column) .pinned-battle-box {
    display: none !important;
}

.ranking-columns {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.ranking-column {
    flex: 1;
    min-width: var(--col-w);
    position: relative;
    border-right: none;
    transition: height 0.6s ease;
}


.ranking-item {
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: var(--row-h);
    display: flex;
    align-items: center;
    gap: var(--row-gap);
    padding: 0 var(--row-px);
    border-radius: 16px;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    overflow: hidden;
}

.ranking-item>* {
    position: relative;
    z-index: 11;
}


.ranking-item.is-rank-1 {
    background: var(--bg-rank-1);
    /* border: 1px solid rgba(255, 208, 81, 0.5); */
}

.ranking-item.is-rank-2 {
    background: var(--bg-rank-2);
    /* border: 1px solid rgba(157, 202, 218, 0.5); */
}

.ranking-item.is-rank-3 {
    background: var(--bg-rank-3);
    /* border: 1px solid rgba(207, 137, 125, 0.5); */
}


.container.single-column .ranking-item {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.container.single-column .ranking-item.is-rank-1 {
    background: var(--bg-rank-1);
    height: 180px;
    z-index: 50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
    --avatar-sz: 110px;
}

.container.single-column .ranking-item.is-rank-2 {
    background: var(--bg-rank-2);
    height: 130px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.container.single-column .ranking-item.is-rank-3 {
    background: var(--bg-rank-3);
    height: 130px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}


.container.single-column .ranking-item.active-battle {
    background: rgba(var(--accent-rgb), 0.50) !important;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.50) !important;
}

.ranking-item.active-battle {
    background: var(--grad-hero);
}

.ranking-item.active-battle .rank-plain {
    /* background: #fff; */
    color: var(--font-color-single-column);
    /* border-color: #fff; */
}

.ranking-item.eliminated .name-text,
.ranking-item.eliminated .player-score {
    opacity: var(--opacity-out);
}

.ranking-item.eliminated .player-avatar {
    filter: grayscale(1) brightness(.4);
    opacity: var(--opacity-out);
}

.ranking-item.eliminated .rank-crown,
.ranking-item.eliminated .rank-plain {
    opacity: var(--opacity-out);
}

@property --wave-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

@keyframes waveRotate {
    from {
        --wave-angle: 0deg
    }

    to {
        --wave-angle: 360deg
    }
}

.ranking-item.wave-60::after,
.ranking-item.wave-30::after,
.ranking-item.wave-10::after {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    z-index: 5;
    padding: 2px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: waveRotate var(--wave-speed) linear infinite;
    border-radius: inherit;
}

.ranking-item.wave-60::after {
    --wave-speed: 2.5s;
    background: conic-gradient(from var(--wave-angle), transparent 0%, transparent 80%, var(--wave-60-color) 96%, #fff 100%);
}

.ranking-item.wave-30::after {
    --wave-speed: 1.5s;
    background: conic-gradient(from var(--wave-angle), transparent 0%, transparent 35%, var(--wave-30-color1) 48%, #fff 50%, transparent 50%, transparent 85%, var(--wave-30-color1) 98%, #fff 100%);
}

.ranking-item.wave-10::after {
    --wave-speed: .8s;
    background: conic-gradient(from var(--wave-angle), transparent 0%, transparent 15%, var(--wave-10-color1) 23%, #fff 25%, transparent 25%, transparent 40%, var(--wave-10-color2) 48%, #fff 50%, transparent 50%, transparent 65%, var(--wave-10-color1) 73%, #fff 75%, transparent 75%, transparent 90%, var(--wave-10-color2) 98%, #fff 100%);
}

.avatar-badge-wrapper {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-avatar {
    /* --avatar-scale comes from the container's data-avatar (small/large) so
       the avatar shrinks/grows uniformly across every layout scope (single,
       multi, rank-1) without fighting the per-scope --avatar-sz cascade. */
    width: calc(var(--avatar-sz) * var(--avatar-scale, 1));
    height: calc(var(--avatar-sz) * var(--avatar-scale, 1));
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--avatar-sz) * 0.38);
    animation: float-avatar 4s ease-in-out infinite;
    flex-shrink: 0;
    position: relative;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.container.single-column .ranking-item.is-rank-1 .player-avatar {
    border-color: var(--c-gold);
    box-shadow: 0 0 18px rgba(255, 215, 0, .6);
}

.container.single-column .ranking-item.is-rank-2 .player-avatar {
    border-color: var(--c-silver);
    box-shadow: 0 0 14px rgba(157, 202, 218, .5);
}

.container.single-column .ranking-item.is-rank-3 .player-avatar {
    border-color: var(--c-bronze);
    box-shadow: 0 0 14px rgba(207, 137, 125, .5);
}

@keyframes float-avatar {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-2px) scale(1.03);
    }
}

.badge-wrapper {
    width: var(--badge-rail-w);
    flex: 0 0 var(--badge-rail-w);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    align-self: stretch;
    margin-left: calc(-1 * var(--row-px));
}

.rank-crown {
    --crown-base-1: #ffe27f;
    --crown-base-2: #d47a19;
    --crown-edge: #f6c34d;
    --crown-jewel: #fff5c2;
    position: relative;
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .35));
}

.container:not(.single-column) .rank-crown {
    width: 60px;
    height: 50px;
}

.rank-crown::before,
.rank-crown::after {
    display: none !important;
}

.rank-crown.r1 {
    --crown-base-1: #ffd86b;
    --crown-base-2: #dd7c17;
    --crown-edge: #ffbf33;
    --crown-jewel: #fff2a8;
}

.rank-crown.r2 {
    --crown-base-1: #d7ebf3;
    --crown-base-2: #568ea8;
    --crown-edge: #8fc4d5;
    --crown-jewel: #f4fbff;
}

.rank-crown.r3 {
    --crown-base-1: #e9b09b;
    --crown-base-2: #b25a31;
    --crown-edge: #dc8b63;
    --crown-jewel: #ffd8c2;
}

.rank-crown__number {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: var(--rank-fs);
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    background: transparent;
    border: none;
    box-shadow: none;
    margin-top: 10px;
}

.container:not(.single-column) .rank-crown__number {
    width: 30px;
    height: 30px;
    font-size: var(--rank-fs);
    margin-top: 0;
}

@keyframes crown-pop {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }

    30% {
        transform: scale(1.7) rotate(-14deg);
        filter: brightness(1.5) drop-shadow(0 0 8px gold);
    }

    55% {
        transform: scale(1.4) rotate(8deg);
    }

    75% {
        transform: scale(1.1) rotate(-3deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
}

.rank-crown.crown-pop {
    animation: crown-pop 0.9s cubic-bezier(0.175, .885, .32, 1.275) forwards;
}

.rank-plain {
    width: var(--badge-w);
    height: var(--badge-w);
    border-radius: 10px;
    background: rgba(0, 0, 0, .4);
    color: var(--font-color-single-column);
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: var(--rank-fs);
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border: none;
    backdrop-filter: none;
}


.container:not(.single-column) .rank-plain {
    background: transparent;
    color: #fff;
    font-size: var(--rank-fs);
    font-weight: 900;
    border: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    box-shadow: none;
}




.container:not(.single-column) .ranking-item {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.20) 0,
            rgba(0, 0, 0, 0.20) var(--badge-rail-w),
            rgba(0, 0, 0, 0.40) var(--badge-rail-w),
            rgba(0, 0, 0, 0.40) 100%);
}

/* rank 1: badge = --bg-head-rank-1, body = --bg-rank-1 */
.container:not(.single-column) .ranking-item.is-rank-1 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-1) 0,
            var(--bg-head-rank-1) var(--badge-rail-w),
            var(--bg-rank-1) var(--badge-rail-w),
            var(--bg-rank-1) 100%);
}

/* rank 2: badge = --bg-head-rank-2, body = --bg-rank-2 */
.container:not(.single-column) .ranking-item.is-rank-2 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-2) 0,
            var(--bg-head-rank-2) var(--badge-rail-w),
            var(--bg-rank-2) var(--badge-rail-w),
            var(--bg-rank-2) 100%);
}

/* rank 3: badge = --bg-head-rank-3, body = --bg-rank-3 */
.container:not(.single-column) .ranking-item.is-rank-3 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-3) 0,
            var(--bg-head-rank-3) var(--badge-rail-w),
            var(--bg-rank-3) var(--badge-rail-w),
            var(--bg-rank-3) 100%);
}



/* rank 4+ (default) */
.container:not(.single-column) .ranking-item.active-battle {
    background: linear-gradient(90deg,
            var(--bg-rank-4-badge-pin) 0,
            var(--bg-rank-4-badge-pin) var(--badge-rail-w),
            var(--grad-hero) var(--badge-rail-w),
            var(--grad-hero) 100%) !important;
}

/* rank 1 */
.container:not(.single-column) .ranking-item.active-battle.is-rank-1 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-1-pin) 0,
            var(--bg-head-rank-1-pin) var(--badge-rail-w),
            var(--grad-hero) var(--badge-rail-w),
            var(--grad-hero) 100%) !important;
}

/* rank 2 */
.container:not(.single-column) .ranking-item.active-battle.is-rank-2 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-2-pin) 0,
            var(--bg-head-rank-2-pin) var(--badge-rail-w),
            var(--grad-hero) var(--badge-rail-w),
            var(--grad-hero) 100%) !important;
}

/* rank 3 */
.container:not(.single-column) .ranking-item.active-battle.is-rank-3 {
    background: linear-gradient(90deg,
            var(--bg-head-rank-3-pin) 0,
            var(--bg-head-rank-3-pin) var(--badge-rail-w),
            var(--grad-hero) var(--badge-rail-w),
            var(--grad-hero) 100%) !important;
}


.container:not(.single-column) .badge-wrapper {
    background: transparent;
    border-right: none;
    border-radius: 0;
    align-self: stretch;
    flex-shrink: 0;
}


.container:not(.single-column) .ranking-item.active-battle {
    border: 2px solid rgba(var(--accent-rgb), 0.80) !important;
}


.container:not(.single-column) .ranking-item.active-battle .rank-crown__number,
.container:not(.single-column) .ranking-item.active-battle .rank-plain {
    color: #fff;
    text-shadow:
        0 0 1px rgba(var(--accent-rgb), 1),
        0 0 4px rgba(var(--accent-rgb), 0.80),
        0 0 10px rgba(var(--accent-rgb), 0.50);
}


.container:not(.single-column) .ranking-item.active-battle .name-text {
    text-shadow:
        0 0 1px rgba(var(--accent-rgb), 1),
        0 0 4px rgba(var(--accent-rgb), 0.80),
        0 0 10px rgba(var(--accent-rgb), 0.50) !important;
}


.container:not(.single-column) .ranking-item.active-battle .player-score {
    text-shadow:
        0 0 1px rgba(var(--accent-rgb), 1),
        0 0 4px rgba(var(--accent-rgb), 0.80),
        0 0 12px rgba(var(--accent-rgb), 0.60);
}

.player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}


.name-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    position: relative;
    margin-right: 15px;
}

.score-wrapper {
    flex-shrink: 0;
    z-index: 20;
    position: relative;
    text-align: right;
}

/* Multi-column: stack name above score (like single-column) so score never overlaps name */
.container:not(.single-column) .player-info {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.container:not(.single-column) .name-wrapper {
    width: 100%;
    margin-right: 0;
    flex: 0 0 auto;
}

.container:not(.single-column) .score-wrapper {
    text-align: left;
    flex-shrink: 0;
}

.name-text {
    display: inline-block;
    white-space: nowrap;
    vertical-align: middle;
    font-size: var(--name-fs);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
    padding-block: 0px;
    overflow: hidden;
    text-overflow: ellipsis;

    max-width: 100%;
}

.player-score {
    font-size: var(--score-fs);
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    line-height: 1.2;
    text-shadow: 0 0 6px #000;
    transition: transform 0.1s;
}

.container.single-column .ranking-item.is-rank-1 .name-text,
.pinned-battle-box .name-text {
    background: linear-gradient(-60deg, #ffffff 40%, #ffff00 45%, #ffffff 50%);
    background-size: 300% 100%;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine-name 3s infinite linear;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 1)) drop-shadow(0 0 6px rgba(0, 0, 0, 1));
    text-shadow: none !important;
}

@keyframes shine-name {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: -50% 50%;
    }
}

.container.single-column .player-info {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.container.single-column .name-wrapper {
    width: 100%;
    margin-right: 0;
    flex: 0 0 auto;
    margin-bottom: 8px;
    /* Pulls score closer to name */
}

.container.single-column .score-wrapper {
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 4px;
    /* Fine-tune spacing */
}

.container.single-column .name-text {
    font-size: calc(var(--name-fs) + 8px);
    line-height: 1.1;
}

.container.single-column .player-score {
    font-size: calc(var(--score-fs) + 12px);
    line-height: 1;
}

.container.single-column .ranking-item.is-rank-1 .name-text {
    font-size: 36px;
    line-height: 1.1;
}

.container.single-column .ranking-item.is-rank-1 .player-score {
    font-size: 62px;
    line-height: 1;
}

.out-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    margin-left: auto;
}

.ranking-item.eliminated .out-wrapper {
    width: calc(var(--out-sz) + 16px);
    opacity: var(--opacity-out);
}

.out-badge-icon {
    width: calc(var(--out-sz) + 20px);
    height: calc(var(--out-sz) + 22px);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5));
    flex-shrink: 0;
}

.container:not(.single-column) .out-badge-icon {
    width: 65px;
    height: 68px;
}

.out-badge-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.custom-crown {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 85px;
    height: auto;
    z-index: 0;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

.container:not(.single-column) .custom-crown {
    width: 42px;
    top: 4px;
}

@keyframes score-pulse {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.6) translateY(-5px);
        color: #fff;
        text-shadow: 0 0 20px var(--score-pulse-glow-1), 0 0 40px var(--score-pulse-glow-2);
    }

    50% {
        transform: scale(1.3) translateY(-2px);
        color: var(--score-pulse-mid);
        text-shadow: 0 0 10px rgba(253, 224, 71, .9);
    }

    100% {
        transform: scale(1);
    }
}

.player-score.pulse {
    animation: score-pulse .6s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.score-burst-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--score-burst-color), transparent);
    z-index: 0;
    pointer-events: none;
    animation: burst-glow 0.8s ease-out forwards;
}

@keyframes burst-glow {
    0% {
        opacity: 1;
        transform: scaleX(0.5);
    }

    100% {
        opacity: 0;
        transform: scaleX(1.6);
    }
}

@keyframes particle-fade {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: var(--target-pos) scale(0);
        opacity: 0;
    }
}

.particle-burst {
    position: absolute;
    right: 20px;
    width: 6px;
    height: 6px;
    background: var(--particle-color);
    box-shadow: 0 0 8px var(--particle-glow);
    border-radius: 50%;
    pointer-events: none;
    z-index: 35;
    animation: particle-fade var(--anim-dur) cubic-bezier(.2, .8, .4, 1) forwards;
}

.coin-float {
    position: absolute;
    right: 70px;
    top: 50%;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, .9);
    pointer-events: none;
    z-index: 30;
    white-space: nowrap;
    animation: coin-rise 1.2s cubic-bezier(.22, 1, .36, 1) forwards;
}

.coin-float .coin-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%, #ffe87a, #f59e0b 55%, #92400e);
    box-shadow: 0 0 10px rgba(251, 191, 36, .8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #78350f;
    flex-shrink: 0;
}

@keyframes coin-rise {
    0% {
        opacity: 0;
        transform: translateY(calc(-50% + 12px)) scale(.5);
    }

    12% {
        opacity: 1;
        transform: translateY(calc(-50% + 2px)) scale(1.15);
    }

    65% {
        opacity: 1;
        transform: translateY(calc(-50% - 26px)) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(calc(-50% - 44px)) scale(.85);
    }
}

.fun-emoji {
    position: absolute;
    bottom: -10px;
    font-size: 32px;
    pointer-events: none;
    z-index: 20;
    animation: float-emoji 1.2s ease-out forwards;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, .6));
}

@keyframes float-emoji {
    0% {
        transform: translateY(0) scale(.5);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translateY(-15px) scale(1.3) rotate(-15deg);
    }

    80% {
        opacity: .8;
    }

    100% {
        transform: translateY(-65px) scale(1) rotate(25deg);
        opacity: 0;
    }
}


@keyframes shake30 {

    0%,
    100% {
        transform: translateX(0)
    }

    20% {
        transform: translateX(-6px)
    }

    40% {
        transform: translateX(6px)
    }

    60% {
        transform: translateX(-4px)
    }

    80% {
        transform: translateX(4px)
    }
}

@keyframes shake10 {

    0%,
    100% {
        transform: translateX(0)
    }

    15% {
        transform: translateX(-8px)
    }

    30% {
        transform: translateX(8px)
    }

    45% {
        transform: translateX(-6px)
    }

    60% {
        transform: translateX(6px)
    }

    75% {
        transform: translateX(-4px)
    }

    90% {
        transform: translateX(4px)
    }
}

.container.shake30 {
    animation: shake30 .5s ease-in-out;
}

.container.shake10 {
    animation: shake10 .7s ease-in-out;
}

@keyframes continuous-shake-1 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0);
    }

    25% {
        transform: translate(-3px, -2px) rotate(-0.5deg);
    }

    50% {
        transform: translate(3px, 2px) rotate(0.5deg);
    }

    75% {
        transform: translate(-2px, 2px) rotate(-0.5deg);
    }
}

.container.shake-continuous-stage1 {
    animation: continuous-shake-1 0.4s ease-in-out infinite;
}

@keyframes continuous-shake-2 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0);
    }

    20% {
        transform: translate(-8px, -6px) rotate(-1deg);
    }

    40% {
        transform: translate(8px, 6px) rotate(1deg);
    }

    60% {
        transform: translate(-6px, 6px) rotate(-1deg);
    }

    80% {
        transform: translate(6px, -6px) rotate(1deg);
    }
}

.container.shake-continuous-stage2 {
    animation: continuous-shake-2 0.25s cubic-bezier(.36, .07, .19, .97) infinite;
}

@keyframes glass-sweep {

    0%,
    15% {
        left: -100%;
        opacity: 0;
    }

    25% {
        opacity: 1;
    }

    40%,
    100% {
        left: 200%;
        opacity: 0;
    }
}

.pinned-battle-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 50px 24px;
    width: 100%;

    border: none;
    border-radius: 0 0 15px 15px;

    background: rgba(var(--accent-rgb), 0.50);
    overflow: hidden;
    z-index: 100;
}

.pinned-battle-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-25deg);
    animation: glass-sweep 8s cubic-bezier(0.3, 0, 0.7, 1) infinite;
    z-index: 2;
    pointer-events: none;
}

.glitter-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.glitter-sparkle {
    position: absolute;
    /* Size is overridden dynamically in JS, but provide baseline */
    width: 14px;
    height: 14px;
    background: #D4F1F4;
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    filter: drop-shadow(0 0 3px rgba(var(--accent-rgb), 1)) drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.8));
    opacity: 0;
    will-change: transform, opacity;
}

.flare-spark {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #E8FFFF;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    top: 50%;
    margin-top: -10px;
    opacity: 0;
    pointer-events: none;
    z-index: 25;
    animation: flash-flare 0.9s ease-out forwards;
    filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), 1)) drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.6));
    will-change: transform, opacity;
}

@keyframes flash-flare {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0) rotate(0deg);
    }

    15% {
        opacity: 1;
        transform: translate(0, calc(var(--flare-y, -20px) * 0.3)) scale(calc(var(--flare-scale, 1) * 1.4)) rotate(30deg);
    }

    35% {
        opacity: 0.6;
        transform: translate(0, calc(var(--flare-y, -20px) * 0.6)) scale(calc(var(--flare-scale, 1) * 0.8)) rotate(60deg);
    }

    55% {
        opacity: 1;
        transform: translate(0, calc(var(--flare-y, -20px) * 0.8)) scale(calc(var(--flare-scale, 1) * 1.3)) rotate(90deg);
    }

    100% {
        opacity: 0;
        transform: translate(0, calc(var(--flare-y, -20px) * 1.5)) scale(0) rotate(135deg);
    }
}

.glitter-continuous-anim {
    animation-name: glitter-continuous-fade;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
}

.glitter-trail-anim {
    animation-name: glitter-trail-fade;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
}

@keyframes glitter-continuous-fade {
    0% {
        transform: scale(0.2) translate(0, 0);
        opacity: 0;
    }

    30% {
        transform: scale(1.5) translate(0, -10px);
        opacity: 1;
    }

    70% {
        transform: scale(1) translate(0, -20px);
        opacity: 0.8;
    }

    100% {
        transform: scale(0.2) translate(0, -30px);
        opacity: 0;
    }
}

@keyframes glitter-trail-fade {
    0% {
        transform: scale(0.2) translate(0, 0);
        opacity: 0;
    }

    3% {
        transform: scale(1.5) translate(0, -5px);
        opacity: 1;
    }

    12% {
        transform: scale(1) translate(0, -15px);
        opacity: 0.8;
    }

    30%,
    100% {
        transform: scale(0) translate(0, -30px);
        opacity: 0;
    }
}


.pinned-battle-box .shooting-star-container {
    background: transparent;
}

.pinned-battle-box .name-wrapper {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin-right: 20px;
}

.pinned-battle-box .name-text {
    font-size: 34px;
    font-weight: 700;
    color: #fff;
}

.pinned-battle-box .player-score {
    font-size: 55px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 0 6px #000;
}

.pinned-battle-box .player-avatar {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, .5);
}

.shooting-star-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
    border-radius: inherit;

    background: transparent;
}


.container:not(.single-column) .ranking-item.active-battle .shooting-star-container {
    background: transparent;
}

.star {
    position: absolute;
    height: 3px;
    width: var(--star-w, 80px);
    top: calc(var(--star-y, 0px));
    left: calc(var(--star-x, 0%));
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    animation: shootingDiagonal var(--star-dur, 5s) var(--star-d, 0s) linear infinite both;
}

@keyframes shootingDiagonal {
    0% {
        transform: translate(-150px, -150px) rotate(45deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translate(1200px, 1200px) rotate(45deg);
        opacity: 0;
    }
}

.pinned-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
}

.ranking-item.elim-drop {
    animation: elim-drop-anim 0.55s cubic-bezier(.36, .07, .19, .97) forwards;
}

@keyframes elim-drop-anim {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    20% {
        transform: translateY(5px) rotate(-1.5deg);
    }

    50% {
        transform: translateY(10px) rotate(1deg);
    }

    75% {
        transform: translateY(6px) rotate(-0.5deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes shake-elim {

    0%,
    100% {
        transform: translateX(0) translateY(0);
    }

    15% {
        transform: translateX(-9px) translateY(3px);
    }

    30% {
        transform: translateX(9px) translateY(-3px);
    }

    45% {
        transform: translateX(-6px) translateY(2px);
    }

    60% {
        transform: translateX(6px) translateY(-2px);
    }

    75% {
        transform: translateX(-4px);
    }

    90% {
        transform: translateX(4px);
    }
}

.container.shake-elim {
    animation: shake-elim .55s ease-in-out;
}

.player-avatar.on-fire::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(#ff4500 0%, #ff8c00 18%, #ff4500 36%, #ff6b00 54%, #ff3300 72%, #ffaa00 90%, #ff4500 100%);
    z-index: -1;
    animation: fire-spin 0.4s linear infinite, fire-pulse 0.8s ease-in-out infinite alternate;
    filter: blur(4px);
}

@keyframes fire-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fire-pulse {
    from {
        opacity: 0.7;
        transform: scale(1);
    }

    to {
        opacity: 1;
        transform: scale(1.12);
    }
}

.speed-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.speed-line {
    position: absolute;
    top: var(--sl-top, 50%);
    left: -120%;
    width: var(--sl-w, 100px);
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--speed-line-color), transparent);
    animation: speed-line-move var(--sl-dur, 0.5s) var(--sl-delay, 0s) linear infinite;
}

@keyframes speed-line-move {
    0% {
        left: -120%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        left: 110%;
        opacity: 0;
    }
}

@keyframes challenger-enter {
    0% {
        transform: translateX(-110%) scaleX(1.4);
        opacity: 0;
        filter: brightness(3);
    }

    25% {
        transform: translateX(6%) scaleX(0.96);
        opacity: 1;
        filter: brightness(1.8);
    }

    55% {
        transform: translateX(-2%) scaleX(1.01);
        filter: brightness(1.2);
    }

    75% {
        transform: translateX(1%);
        filter: brightness(1);
    }

    100% {
        transform: translateX(0);
        opacity: 1;
        filter: brightness(1);
    }
}

.ranking-item.challenger-enter {
    animation: challenger-enter 0.7s cubic-bezier(.22, 1, .36, 1) forwards !important;
}

.challenger-trail {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(90deg, rgba(255, 180, 0, 0.5) 0%, rgba(255, 100, 0, 0.2) 40%, transparent 100%);
    animation: trail-fade 0.6s ease-out forwards;
}

@keyframes trail-fade {
    0% {
        opacity: 1;
        transform: scaleX(1.3);
    }

    100% {
        opacity: 0;
        transform: scaleX(1);
    }
}

/* SUSPENSE REVEAL */
.suspense-dim {
    opacity: 0.15 !important;
    filter: grayscale(1) blur(1px);
    transition: opacity 0.8s ease, filter 0.8s ease;
}

.ranking-item.eliminated.suspense-dim .name-text,
.ranking-item.eliminated.suspense-dim .player-score,
.ranking-item.eliminated.suspense-dim .player-avatar,
.ranking-item.eliminated.suspense-dim .rank-crown,
.ranking-item.eliminated.suspense-dim .rank-plain,
.ranking-item.eliminated.suspense-dim .out-wrapper {
    opacity: 1;
}

.suspense-focus {
    z-index: 100 !important;
    animation: suspense-heartbeat 1s infinite;
}

@keyframes suspense-heartbeat {

    0%,
    100% {
        scale: 1;
    }

    10%,
    30% {
        scale: 1.02;
        box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.2);
    }
}

.rank3-reveal {
    animation: reveal-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: inset 0 0 30px var(--reveal-glow-rank3);
    z-index: 80 !important;
}

.rank2-reveal {
    animation: reveal-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: inset 0 0 30px var(--reveal-glow-rank2);
    z-index: 85 !important;
}

.rank1-reveal {
    animation: reveal-pop-mega 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, fade-gold-glow 2.5s ease-out forwards;
    z-index: 120 !important;
}

@keyframes fade-gold-glow {

    0%,
    40% {
        box-shadow: 0 0 80px var(--reveal-glow-rank1), inset 0 0 50px rgba(255, 215, 0, 0.5);
        background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.4), rgba(255, 215, 0, 0.2)) !important;
    }

    100% {
        box-shadow: 0 0 0px transparent, inset 0 0 0px transparent;
        background: linear-gradient(90deg, rgba(255, 208, 81, 0.2) 0%, rgba(30, 30, 40, 0.9) 100%) !important;
    }
}

@keyframes reveal-pop {
    0% {
        scale: 0.8;
        translate: 0 20px;
        opacity: 0;
        filter: brightness(2);
    }

    100% {
        scale: 1;
        translate: 0 0;
        opacity: 1;
        filter: brightness(1);
    }
}

@keyframes reveal-pop-mega {
    0% {
        scale: 0.4;
        translate: 0 60px;
        opacity: 0;
        filter: brightness(3);
    }

    40% {
        scale: 1.15;
        translate: 0 -10px;
        opacity: 1;
        filter: brightness(2);
    }

    100% {
        scale: 1;
        translate: 0 0;
        opacity: 1;
        filter: brightness(1);
    }
}

.shake-intense {
    animation: shake-intense-anim 0.6s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake-intense-anim {

    0%,
    100% {
        transform: translate(0, 0) rotate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translate(-15px, -12px) rotate(-3deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translate(15px, 12px) rotate(3deg);
    }
}

.grand-particle {
    position: fixed;
    width: var(--gp-sz, 8px);
    height: var(--gp-sz, 8px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9200;
    animation: grand-particle-fly var(--gp-dur, 1.5s) ease-out forwards;
}

@keyframes grand-particle-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: var(--gp-target) scale(0.1);
    }
}
/* Hearts/lives indicator (PK only) */
.rank-hearts {
  color: #ff4d6d;
  font-weight: 700;
  font-size: 0.8em;
  letter-spacing: 1px;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.rank-hearts.down { opacity: 0.5; }

/* ── Avatar size (RankingWidgetSettings.avatar_display) ─────────────────────
   Driven by data-avatar on #main-container (.container). `large` is the
   overlay's native sizing; `small` scales every avatar down uniformly;
   `none` hides avatars entirely (independent of show_profile). */
.container[data-avatar="small"]  { --avatar-scale: 0.66; }
.container[data-avatar="large"]  { --avatar-scale: 1; }
.container[data-avatar="none"] .player-avatar { display: none; }
