@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&family=Noto+Sans+Thai:wght@700;900&family=Rajdhani:wght@500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: transparent;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: transparent;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}



/*-------------------  set icon status */
.icon-svg {
    width: 35px;
    height: 35px;
    vertical-align: middle;
    margin: 0 6px;
}

/*-------------------  set icon hand */
.icon-hand-svg {
    width: 45px;
    height: 45px;
    vertical-align: middle;
    margin: 0 6px;
}



/* ─── Container ─────────────────────────────────── */
.pk-container {
    width: 100%;
    max-width: 1100px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pk-top-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 0;
    /* Removed padding to let them go to absolute edges */
    z-index: 10;
    position: relative;
    /* Added for absolute centering of round-info */
}

.pk-team-label-col {
    display: flex;
    flex-direction: column;
    width: 320px;
    position: relative;
}

.pk-team-label-col.right {
    align-items: flex-end;
}

.pk-main-card {
    width: calc(100% + 70px);
    margin-left: -35px;
    margin-right: -35px;
    height: 275px;
    /* absolute height based on SVG */
    min-height: 275px;
    /* Increased opacity and darkened rgb from SVG's default 0.6 for the pink side */
    background: linear-gradient(90deg, rgba(197, 22, 87, 0.4) 0%, rgba(5, 120, 220, 0.4) 100%);
    border: 5px solid rgba(227, 227, 227, 0.4);
    border-radius: 17.5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0;
    overflow: hidden;

}

.pk-card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align to top of content area */
    padding: 50px 16.5px 0 16.5px;
    /* Offset relative to inner border to match x=24, y=32 */
    height: 160px;
}

.pk-card-side {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pk-card-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}



/* Timer pulse + scale */
@keyframes timer-warning {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    40% {
        opacity: 0.4;
        transform: scale(1.12);
    }

    70% {
        opacity: 0.8;
        transform: scale(1.04);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.pk-container.warning .pk-timer {
    color: #ff2d2d;
    font-size: 100px;
    letter-spacing: 0;
    -webkit-text-stroke: 3px rgba(255, 0, 0, 0.8);
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    animation: timer-warning 0.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

/* Container shake */
@keyframes warning-shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    15% {
        transform: translate(-2px, 1px);
    }

    35% {
        transform: translate(2px, -1px);
    }

    55% {
        transform: translate(-1px, 0);
    }

    75% {
        transform: translate(1px, 1px);
    }
}

.pk-container.warning {
    animation: warning-shake 0.6s ease-in-out infinite;
}


/* Score bar heartbeat */
@keyframes warning-heartbeat {

    0%,
    100% {
        transform: scaleY(1);
    }

    15% {
        transform: scaleY(1.06);
    }

    30% {
        transform: scaleY(1);
    }

    45% {
        transform: scaleY(1.04);
    }

    60% {
        transform: scaleY(1);
    }
}

.pk-container.warning .pk-score-bar {
    animation: warning-heartbeat 0.8s ease-in-out infinite;
}


/* ─── HEADER ─────────────────────────────────────── */
.pk-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    padding: 0 40px;
}

.pk-team-column {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Prevent crushing when center text grows */
}

.pk-team-column.left {
    align-items: flex-start;
}

.pk-team-column.right {
    align-items: flex-end;
}

.team-label-top {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: #fff;
    font-weight: 900;
    margin-bottom: 5px;
    /* Moved up by 10px (was -5px) */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    z-index: 5;
    position: relative;
}

.pk-team-column.left .team-label-top {
    margin-left: 0;
    /* Fully flush to the left edge */
}

.pk-team-column.right .team-label-top {
    margin-right: 0;
    /* Fully flush to the right edge */
}

.pk-team-profile {
    display: flex;
    align-items: center;
}

/* Redesigned Name Boxes (Top Row) */
.idol-name-box {
    background: rgba(28, 30, 41, 0.95);
    border-radius: 10px;
    padding: 0;
    width: 320px;
    min-width: 320px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.idol-name-box.left {
    border: 4px solid #FF55AF;
    box-shadow: 0 0 20px rgba(255, 85, 175, 0.9), 0 0 35px rgba(255, 85, 175, 0.5);
    margin-left: -40px;
    /* Tuck under avatar */
}

.idol-name-box.right {
    border: 4px solid #00B9C7;
    box-shadow: 0 0 20px rgba(0, 185, 199, 0.9), 0 0 35px rgba(0, 185, 199, 0.5);
    margin-right: -40px;
    /* Tuck under avatar */
}

.idol-name {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 900;
    font-size: 28px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    display: inline-block;
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

.idol-name.marquee-active {
    width: auto;
    text-align: left;
    padding-left: 100%;
    animation: scroll-text-left 10s linear infinite;
}

@keyframes scroll-text-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Wings + Avatar Container */
.avatar-container {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    overflow: visible;
    flex-shrink: 0;
}

.pk-team-profile.left .avatar-container {
    filter: drop-shadow(0 0 10px rgba(255, 85, 175, 1)) drop-shadow(0 0 25px rgba(255, 85, 175, 0.8));
}

.pk-team-profile.right .avatar-container {
    filter: drop-shadow(0 0 10px rgba(0, 185, 199, 1)) drop-shadow(0 0 25px rgba(0, 185, 199, 0.8));
}

/* ── Avatar Frame Overlay (SVG ring + wings) ── */
.avatar-frame {
    position: absolute;
    width: 153px;
    /* Scaling the 118px SVG to fit its inner 61px ring over the 80px avatar */
    pointer-events: none;
    z-index: 4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.team-avatar {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    border-radius: 50%;
    background: #888;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.team-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Idol Name Box */
/* Score labels have been moved inside the progress bars below */

.score-section {
    position: absolute;
    bottom: 24px;
    /* Increased 15px bottom space */
    left: 21.5px;
    right: 21.5px;
    height: 80px;
    z-index: 10;
}

.score-bar-wrapper {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: stretch;
}

.pk-score-bar {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 40px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.score-side {
    height: 100%;
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    min-width: 120px;
    overflow: visible;
}

/* Defender Bar: Purple to Pink */
.score-side.blue {
    background: linear-gradient(90deg, #AC0AE2 0%, #EE1D52 100%);
    justify-content: flex-start;
    padding-left: 27px;
    /* matches x=51 SVG text start */
    border-radius: 40px 0 0 40px;
}

/* Attacker Bar: Blue to Green */
.score-side.pink {
    background: linear-gradient(90deg, #0787FF 0%, #00B16A 100%);
    justify-content: flex-end;
    padding-right: 27px;
    border-radius: 0 40px 40px 0;
}

.score-label-left,
.score-label-right {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 60px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.clash-indicator {
    display: none;
}

.idol-name {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 700;
    font-size: 32px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    min-width: 140px;
    text-align: center;
}

/* Round Info */
.pk-round-info {
    display: none;
    /* Hidden per user request, was flex */
    align-items: center;
    gap: 16px;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 40px;
    font-weight: 700;
    position: absolute;
    left: 50%;
    bottom: 16px;
    /* Aligns center of text with center of avatars */
    transform: translateX(-50%);
    white-space: nowrap;
}

.round-text {
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.red-arrow {
    color: #ff2a7a;
    text-shadow: 0 0 10px rgba(255, 42, 122, 0.6);
}

.blue-arrow {
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

/* ─── MAIN PANEL ─────────────────────────────────── */
.pk-main {
    margin-top: 10px;
    padding: 24px 32px;
    background: linear-gradient(90deg, #A12B6B 0%, #4D3C8A 50%, #206FBA 100%);
    border-radius: 20px;
    border: 4px solid #fff;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* ─── GIFT + TIMER ROW ───────────────────────────── */
.gift-timer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.gift-strip-side {
    width: 385px;
    /* Fit up to 4 gifts side-by-side (85x4 + 15x3) */
    height: 85px;
    display: flex;
    align-items: center;
}

.gift-strip-side.left {
    justify-content: flex-start;
}

.gift-strip-side.right {
    justify-content: flex-end;
}

.marquee-clip {
    width: 100%;
    height: 140%;
    overflow: hidden;
    position: relative;
    display: flex;
}

.marquee-track {
    display: flex;
    gap: 15px;
    align-items: center;
}

.gift-icon {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    /* Transparent back for icon */
}

/* ─── TIMER ─────────────────────────────────────── */
.pk-timer {
    font-family: 'Montserrat';
    font-size: 100px;
    /* Reduced from 130px so it fits better */
    font-weight: 700;
    /* Thinner than before (was 900) */
    color: #fff;
    text-align: center;
    letter-spacing: 2px;
    line-height: 1;
    text-shadow: 4px 8px 12px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    padding: 0 20px;
}

.pk-timer.timer-ready {
    font-size: 60px;
    color: #ffffff;
    text-shadow: 0 0 30px #ffffff, 0 4px 24px rgba(0, 0, 0, 0.7);
}

.pk-timer.timer-timeup {
    font-size: 56px;
    color: #ff4444;
    animation: timeup-pulse 0.8s ease-in-out infinite alternate;
}

.pk-timer.disconnected {
    opacity: 0.25;
    text-shadow: none;
}

/* ─── SCORE BAR ──────────────────────────────────── */




/* ─── SCORE CHANGE EFFECTS ─────────────────────── */
/* losing side */
.score-side.losing {
    opacity: 0.85;
    filter: brightness(0.8);
}

/* Boost flash overlay */
.score-boost-flash {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
    animation: boost-flash 0.6s ease-out forwards;
}

/* Defender visual Purple/Pink flash */
.score-boost-flash.blue {
    background: radial-gradient(ellipse at center, rgba(217, 70, 239, 0.6) 0%, rgba(124, 58, 237, 0.3) 40%, transparent 70%);
}

/* Attacker visual Teal/Green flash */
.score-boost-flash.pink {
    background: radial-gradient(ellipse at center, rgba(52, 211, 153, 0.6) 0%, rgba(13, 148, 136, 0.3) 40%, transparent 70%);
}

@keyframes boost-flash {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Score number pop */
.score-pop-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: inherit;
    padding: inherit;
    pointer-events: none;
    z-index: 4;
    font-size: inherit;
    font-weight: 900;
    color: #fff;
    animation: pop-bounce 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 255, 255, 0.4);
}

@keyframes pop-bounce {
    0% {
        transform: scale(1.5);
        opacity: 0.8;
    }

    40% {
        transform: scale(0.9);
        opacity: 0.4;
    }

    70% {
        transform: scale(1.1);
        opacity: 0.2;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Floating +X */
.score-floater {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 900;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
    animation: mk-float 1s ease-out forwards;
}

/* Defender Purple/Pink text */
.score-floater.blue {
    color: #f5d0fe;
    text-shadow: 0 0 12px #d946ef, 0 0 24px #7c3aed, 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Attacker Teal/Green text */
.score-floater.pink {
    color: #a7f3d0;
    text-shadow: 0 0 12px #34d399, 0 0 24px #0d9488, 0 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes mk-float {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.3) rotate(-10deg);
    }

    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(-15px) scale(1.4) rotate(5deg);
    }

    40% {
        transform: translateX(-50%) translateY(-35px) scale(1.1) rotate(-3deg);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-80px) scale(0.6) rotate(0deg);
    }
}

/* Star burst */
.score-star {
    position: absolute;
    pointer-events: none;
    z-index: 18;
    font-size: 20px;
    animation: mk-star 0.8s ease-out var(--delay, 0s) forwards;
}

@keyframes mk-star {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5) rotate(180deg) translate(var(--tx, 0px), var(--ty, 0px));
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(360deg) translate(calc(var(--tx, 0px) * 2), calc(var(--ty, 0px) * 2));
    }
}

/* Boost flame trail */
.score-flame {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    pointer-events: none;
    z-index: 5;
    animation: mk-flame 0.5s ease-out forwards;
    background: radial-gradient(ellipse at center, rgba(255, 200, 0, 0.9) 0%, rgba(255, 100, 0, 0.6) 40%, transparent 70%);
    border-radius: 50%;
    filter: blur(4px);
}

.score-flame.blue {
    left: -10px;
}

.score-flame.pink {
    right: -10px;
}

@keyframes mk-flame {
    0% {
        opacity: 1;
        transform: translateY(-50%) scaleX(1.5) scaleY(1);
    }

    50% {
        opacity: 0.8;
        transform: translateY(-50%) scaleX(2) scaleY(1.3);
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scaleX(0.5) scaleY(0.5);
    }
}

/* Speed streak particles */
.score-streak {
    position: absolute;
    top: var(--y, 50%);
    width: var(--w, 20px);
    height: 2px;
    pointer-events: none;
    z-index: 15;
    border-radius: 2px;
    animation: mk-streak 0.4s linear var(--delay, 0s) forwards;
}

.score-streak.blue {
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(217, 70, 239, 0.8), #fff);
    box-shadow: 0 0 4px rgba(217, 70, 239, 0.6);
}

.score-streak.pink {
    background: linear-gradient(270deg, transparent, rgba(52, 211, 153, 0.8), #fff);
    box-shadow: 0 0 4px rgba(52, 211, 153, 0.6);
}

@keyframes mk-streak {
    0% {
        opacity: 1;
        transform: scaleX(0.3);
    }

    50% {
        opacity: 1;
        transform: scaleX(1.5);
    }

    100% {
        opacity: 0;
        transform: scaleX(0.1) translateX(var(--dir, -30px));
    }
}


.score-profiles {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
}

.score-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-profile.right {
    flex-direction: row-reverse;
}

.score-profile-avatar {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-profile.left .score-profile-avatar {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5), 0 0 16px rgba(56, 189, 248, 0.3);
}

.score-profile.right .score-profile-avatar {
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.5), 0 0 16px rgba(244, 63, 94, 0.3);
}

.score-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.score-profile-name {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ═══════════════════════════════════════════════════
   RESULT OVERLAY
═══════════════════════════════════════════════════ */
#result-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
}

#result-overlay.show {
    pointer-events: all;
    opacity: 1;
}

.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
}

.result-avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    position: relative;
    z-index: 2;
}

.result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-name {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 900;
    font-size: 48px;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
    z-index: 2;
    position: relative;
}

.result-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 28px;
    letter-spacing: 4px;
    text-transform: uppercase;
    z-index: 2;
    position: relative;
}

/* ── WINNER ───────────────────────────────────────── */
@keyframes winner-entrance {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.1) rotate(2deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes winner-glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.5), 0 0 120px rgba(255, 165, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0.9), 0 0 100px rgba(255, 215, 0, 0.8), 0 0 200px rgba(255, 165, 0, 0.5);
    }
}

.result-card.winner .result-avatar {
    border: 6px solid gold;
    animation: winner-entrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        winner-glow-pulse 1.5s ease-in-out 0.8s infinite;
}

.result-card.winner .result-label {
    color: gold;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes confetti-fly {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-300px) rotate(720deg);
        opacity: 0;
    }
}

.confetti-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: confetti-fly 1.5s ease-out forwards;
    z-index: 1;
}

@keyframes punch-left {
    0% {
        transform: translateX(-300px) scaleX(-1);
        opacity: 0;
    }

    40% {
        transform: translateX(20px) scaleX(-1);
        opacity: 1;
    }

    55% {
        transform: translateX(-30px) scaleX(-1);
    }

    70% {
        transform: translateX(10px) scaleX(-1);
    }

    100% {
        transform: translateX(-300px) scaleX(-1);
        opacity: 0;
    }
}

@keyframes punch-right {
    0% {
        transform: translateX(300px);
        opacity: 0;
    }

    40% {
        transform: translateX(-20px);
        opacity: 1;
    }

    55% {
        transform: translateX(30px);
    }

    70% {
        transform: translateX(-10px);
    }

    100% {
        transform: translateX(300px);
        opacity: 0;
    }
}

.punch {
    position: absolute;
    font-size: 80px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    line-height: 1;
}

.punch.left {
    left: -160px;
    animation: punch-left 1.2s ease-in-out 0.6s both;
}

.punch.right {
    right: -160px;
    animation: punch-right 1.2s ease-in-out 0.6s both;
}

/* ── LOSER ────────────────────────────────────────── */
@keyframes loser-entrance {
    0% {
        transform: scale(1.2);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes screen-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(-12px) rotate(-1deg);
    }

    20% {
        transform: translateX(12px) rotate(1deg);
    }

    30% {
        transform: translateX(-10px) rotate(-0.5deg);
    }

    40% {
        transform: translateX(10px) rotate(0.5deg);
    }

    50% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(6px);
    }

    70% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }

    90% {
        transform: translateX(-2px);
    }
}

@keyframes red-flash {

    0%,
    100% {
        background: transparent;
    }

    20% {
        background: rgba(255, 0, 0, 0.35);
    }

    40% {
        background: transparent;
    }

    60% {
        background: rgba(255, 0, 0, 0.2);
    }
}

.result-card.loser .result-avatar {
    border: 6px solid #ff2d2d;
    box-shadow: 0 0 0 4px rgba(255, 0, 0, 0.4), 0 0 60px rgba(255, 0, 0, 0.5);
    animation: loser-entrance 0.5s ease-out forwards;
    filter: grayscale(30%);
}

.result-card.loser .result-label {
    color: #ff4444;
    text-shadow: 0 0 16px rgba(255, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.8);
}

#result-overlay.loser-phase {
    animation: screen-shake 0.6s ease-in-out 0.3s both;
}

#result-overlay.loser-phase::before {
    content: '';
    position: fixed;
    inset: 0;
    animation: red-flash 0.8s ease-in-out 0.2s both;
    pointer-events: none;
    z-index: 998;
}

/* ── DRAW ─────────────────────────────────────────── */
@keyframes draw-glow {
    from {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4), 0 0 30px rgba(255, 255, 255, 0.3);
    }

    to {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.9), 0 0 80px rgba(255, 255, 255, 0.7);
    }
}

@keyframes draw-entrance {
    0% {
        transform: scale(0.5) translateY(40px);
        opacity: 0;
    }

    70% {
        transform: scale(1.05) translateY(-5px);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.draw-avatar {
    border: 6px solid #fff;
    animation: draw-entrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        draw-glow 1s ease-in-out infinite alternate;
}

.draw-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 36px;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 2px 8px rgba(0, 0, 0, 0.8);
    text-align: center;
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 5;
}

/* ── FADE IN / OUT ────────────────────────────────── */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.result-card.fade-in {
    animation: fade-in 0.5s ease forwards;
}

.result-card.fade-out {
    animation: fade-out 0.5s ease forwards;
}

.draw-card.fade-in {
    animation: fade-in 0.5s ease forwards;
}

.draw-card.fade-out {
    animation: fade-out 0.5s ease forwards;
}

/* ─── RESPONSIVE ────────────────────────────────── */
@media (max-width: 768px) {
    .pk-timer {
        font-size: 64px;
        letter-spacing: 10px;
    }

    .idol-name {
        font-size: 18px;
        min-width: 90px;
        padding: 5px 14px;
    }

    .team-avatar {
        width: 56px;
        height: 56px;
        font-size: 26px;
    }

    .score-label-left,
    .score-label-right {
        font-size: 26px;
        min-width: 44px;
    }

    .pk-score-bar {
        height: 52px;
        border-radius: 26px;
    }

    .pk-main {
        padding: 8px 10px 18px;
    }

    .gift-icon {
        width: 60px;
        height: 60px;
    }

    .result-avatar {
        width: 140px;
        height: 140px;
        font-size: 56px;
    }

    .result-name {
        font-size: 32px;
    }

    .score-profiles {
        margin-top: 24px;
    }

    .score-profile-avatar {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .score-profile-name {
        font-size: 16px;
    }
}