.shared-game-over {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.shared-game-over.show {
    opacity: 1;
    pointer-events: auto;
}

.game-over-overlay.p2-perspective,
.shared-game-over.p2-perspective {
    transform: rotate(180deg);
    transform-origin: 50% 50%;
}

.shared-game-over .game-over-content {
    width: 80vw;
    max-width: 560px;
    box-sizing: border-box;
    text-align: center;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.shared-game-over .winner-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: sharedWinnerEmojiBounce 1s ease-out infinite;
}

@keyframes sharedWinnerEmojiBounce {
    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

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

.shared-game-over #winner-text {
    font-family: var(--game-font-family, 'Jua', sans-serif);
    font-size: clamp(2.1rem, 8vw, 2.9rem);
    color: var(--shared-go-title-color, #ffd54f);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    margin-bottom: 8px;
    line-height: 1.15;
}

.shared-game-over .win-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.25) 0%, rgba(255, 60, 0, 0.15) 100%);
    border: 1px solid rgba(255, 107, 53, 0.5);
    border-radius: 999px;
    animation: streakPulse 1.5s ease-in-out infinite;
}

.shared-game-over .win-streak-badge[hidden] {
    display: none;
}

.shared-game-over .win-streak-fire {
    font-size: 1.2rem;
    animation: fireFlicker 0.6s ease-in-out infinite alternate;
}

.shared-game-over .win-streak-text {
    font-family: var(--game-font-family, 'Jua', sans-serif);
    font-size: clamp(1rem, 4vw, 1.2rem);
    color: #ff6b35;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

@keyframes streakPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 107, 53, 0.3);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 107, 53, 0.55);
    }
}

@keyframes fireFlicker {
    from { transform: scale(1) rotate(-3deg); }
    to   { transform: scale(1.15) rotate(3deg); }
}

.shared-game-over #winner-score {
    display: none;
}

.shared-game-over .final-scores {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    width: min(100%, 360px);
}

.shared-game-over .final-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 8px 0;
    font-family: var(--game-font-family, 'Jua', sans-serif);
    font-size: clamp(1rem, 4.3vw, 1.2rem);
    color: #f5f5f5;
}

.shared-game-over .final-score-row:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shared-game-over #final-p1-score {
    color: var(--shared-go-p1-color, #4fc3f7);
    font-weight: 700;
}

.shared-game-over #final-p2-score {
    color: var(--shared-go-p2-color, #ff8a65);
    font-weight: 700;
}

.shared-game-over .game-over-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.shared-game-over #restart-btn,
.shared-game-over #hub-btn {
    display: block;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    padding: 14px 25px;
    font-family: var(--game-font-family, 'Jua', sans-serif);
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

.shared-game-over #share-btn {
    display: inline-flex;
    appearance: none;
    -webkit-appearance: none;
    align-items: center;
    justify-content: center;
    margin: 2px auto 0;
    padding: 7px 14px;
    width: auto;
    max-width: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.74);
    font-family: var(--game-font-family, 'Jua', sans-serif);
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    opacity: 0.75;
    backdrop-filter: blur(6px);
    cursor: pointer;
}

.shared-game-over #share-btn:active {
    transform: scale(0.96);
    opacity: 0.95;
}

.shared-game-over #restart-btn {
    background: linear-gradient(180deg, #ffd54f 0%, #c49a1c 100%);
    color: #111;
    box-shadow: 0 4px 0 #8b6914;
}

.shared-game-over #hub-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ddd;
}
