/* ===== GAME RESULT OVERLAY ===== */
#game-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    text-align: center;
    padding: clamp(20px, 3vw, 36px) clamp(28px, 4vw, 56px);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
    animation: result-appear 0.4s ease-out;
    min-width: clamp(220px, 28vw, 360px);
}

@keyframes result-appear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.result-title {
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.result-title.victory { color: #4caf50; text-shadow: 0 0 20px rgba(76, 175, 80, 0.4); }
.result-title.defeat  { color: #ef5350; text-shadow: 0 0 20px rgba(239, 83, 80, 0.3); }
.result-title.draw    { color: #d4af37; text-shadow: 0 0 20px rgba(212, 175, 55, 0.3); }

.result-contract {
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: #999;
    margin-bottom: 16px;
}

.result-scores {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    font-weight: 600;
    margin-bottom: 20px;
}

.result-scores .team-ns { color: #a5d6a7; }
.result-scores .team-ew { color: #ef9a9a; }

.belote-note {
    font-size: 0.8em;
    font-weight: 400;
    color: #d4af37;
}

.result-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-restart, .result-analyse {
    padding: 10px 28px;
    font-size: clamp(0.9rem, 1vw, 1rem);
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.result-analyse {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #bbb;
}
.result-analyse:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== CONFETTI ===== */
#confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 39;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(var(--fall-dist)) rotate(var(--spin)) scale(0.5); opacity: 0; }
}

/* ===== SCORE BREAKDOWN (watch/replay end-of-game) ===== */
.stats-contract-result {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.stats-contract-result.contract-made {
    color: #a5d6a7;
    background: rgba(76, 175, 80, 0.15);
}

.stats-contract-result.contract-failed {
    color: #ef9a9a;
    background: rgba(229, 115, 115, 0.15);
}

.stats-score-line {
    text-align: center;
    font-size: 0.8rem;
    color: #bbb;
    padding: 1px 0;
}

.stats-final-scores {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #d4af37;
    padding: 4px 0 2px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 4px;
}

/* ===== SCORE BREAKDOWN (play tab end-of-game) ===== */
.result-contract-detail {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.result-contract-detail.contract-made {
    color: #a5d6a7;
    background: rgba(76, 175, 80, 0.15);
}

.result-contract-detail.contract-failed {
    color: #ef9a9a;
    background: rgba(229, 115, 115, 0.15);
}

.result-score-line {
    font-size: 0.85rem;
    color: #bbb;
    padding: 2px 0;
}

.result-final-scores {
    font-size: 0.95rem;
    font-weight: 700;
    color: #d4af37;
    padding: 4px 0 2px;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 4px;
}
