/* Congratulations Notification CSS */
/* Usage: Include this CSS file in your HTML. Colors fall back to the warm game palette. */

/* Congratulations Overlay */
.congratulations-overlay {
    position: fixed;
    inset: 0; /* the page, or the scaled stage when the overlay sits inside it */
    background: rgba(74, 38, 22, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
    font-family: var(--font-pixel, 'Tiny5', monospace);
    color: var(--ink, #4a2616);
}

.congratulations-overlay.show {
    display: flex;
}

/* Fireworks sit inside the overlay, above the dimming and behind the card */
.fireworks-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.congratulations-content {
    position: relative;
    width: min(420px, 92vw);
    padding: 18px 18px 16px;
    text-align: center;
    background: var(--paper, #fff3d6);
    border: 5px solid var(--ink, #4a2616);
    border-radius: 22px;
    box-shadow: 0 8px 0 rgba(74, 38, 22, 0.45);
    animation: cg-pop-in 0.5s ease-out;
}

@keyframes cg-pop-in {
    0% { transform: scale(0.7); opacity: 0; }
    70% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); }
}

.congratulations-title {
    font-size: clamp(32px, 9vw, 46px);
    font-weight: normal;
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-shadow: 3px 3px 0 var(--accent-orange, #ff8a2a);
}

.winner-info {
    margin-top: 10px;
}

/* The winner, drawn by PIXI at 240x150 */
.cg-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    border-radius: 14px;
    background: radial-gradient(70% 80% at 50% 90%, rgba(255, 212, 59, 0.75), rgba(255, 212, 59, 0) 70%);
}

.cg-stage canvas {
    image-rendering: pixelated;
}

/* Top gift senders of the winner */
.cg-podium {
    display: grid;
    gap: 7px;
}

.cg-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: 3px solid var(--ink, #4a2616);
    border-radius: 12px;
    font-size: 22px;
    text-align: left;
}

.cg-place {
    flex: none;
    width: 28px;
    height: 28px;
    border: 3px solid var(--ink, #4a2616);
    border-radius: 8px;
    font-size: 18px;
    line-height: 22px;
    text-align: center;
}

.cg-row img {
    flex: none;
    width: 36px;
    height: 36px;
    border: 3px solid var(--ink, #4a2616);
    border-radius: 9px;
    object-fit: cover;
}

.cg-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cg-points {
    flex: none;
    font-size: 17px;
}

.cg-place-1 { background: #ffe58a; }
.cg-place-1 .cg-place { background: var(--gold, #ffd43b); }
.cg-place-2 { background: #fff0cf; }
.cg-place-2 .cg-place { background: var(--silver, #eadfcb); }
.cg-place-3 { background: #ffe0c2; }
.cg-place-3 .cg-place { background: var(--copper, #e58a4b); }

.countdown-section {
    margin-top: 12px;
    font-size: 20px;
}

.countdown-timer {
    display: inline-block;
    min-width: 38px;
    margin-left: 6px;
    padding: 0 8px;
    background: var(--accent-orange, #ff8a2a);
    border: 3px solid var(--ink, #4a2616);
    border-radius: 8px;
}

/* One firework burst: square pixels are the box-shadows of this 9px square (set from JS) */
.cg-burst {
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--paper, #fff3d6);
    opacity: 0;
    animation: cg-burst 2.2s ease-out forwards;
}

@keyframes cg-burst {
    0% { transform: scale(0.15); opacity: 0; }
    12% { opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.cg-confetti {
    position: absolute;
    top: 0;
    width: 9px;
    height: 9px;
    animation: cg-confetti-fall 3s ease-in infinite backwards;
}

@keyframes cg-confetti-fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(calc(var(--fall, 100vh) * 1.1)) rotate(360deg);
        opacity: 0;
    }
}
