/* Match resolution modal, post-game summary, and any future modals. */

.game-over-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.35);
    /* The match resolves mid-action; ease the overlay in so it is not a jump cut. */
    animation: game-over-overlay-in 250ms ease-out both;
}

.game-over-dialog {
    position: relative;
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: clamp(18px, 4vw, 26px);
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent);
    border-radius: 8px;
    background: rgba(18, 22, 29, 0.86);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: game-over-dialog-in 250ms ease-out both;
}

/*
 * Transparent overlay held above the dialog for the first second after it
 * appears. It swallows every pointer event so a frantic end-of-match tap
 * cannot dismiss the modal before the player has read it.
 */
.game-over-input-shield {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: wait;
}

@keyframes game-over-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes game-over-dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-over-overlay,
    .game-over-dialog {
        animation-duration: 1ms;
    }
}

.game-over-dialog.outcome-win {
    border-top-color: var(--accent-light);
}

.game-over-dialog.outcome-loss {
    border-top-color: #c64e4e;
}

.game-over-dialog.outcome-draw {
    border-top-color: var(--warn);
}

.game-over-dialog h2 {
    margin: 0;
    font-size: clamp(2rem, 7vw, 2.8rem);
    line-height: 1;
    text-transform: uppercase;
}

.game-over-dialog.outcome-win h2 {
    color: var(--accent-light);
}

.game-over-dialog.outcome-loss h2 {
    color: #f08a72;
}

.game-over-dialog.outcome-draw h2 {
    color: var(--warn);
}

.game-over-detail {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

/* The defeated bot's parting line, sitting above the outcome headline. */
.game-over-resignation {
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.45;
    text-wrap: balance;
}

.game-over-resignation::before {
    content: "\201C";
}

.game-over-resignation::after {
    content: "\201D";
}

.game-over-warning {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(var(--danger-rgb), 0.45);
    background: rgba(var(--danger-rgb), 0.12);
    color: rgb(var(--danger-rgb));
    font-size: 0.9rem;
    line-height: 1.4;
}

.game-over-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 4px 0 0;
}

.game-over-stats div {
    display: grid;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.game-over-stats dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.game-over-stats dd {
    margin: 0;
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 1.3rem;
    font-weight: 800;
}

.game-over-bot-summary {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    text-align: left;
}

.game-over-bot-summary p {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.game-over-bot-summary dl {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0;
}

.game-over-bot-summary div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.game-over-bot-summary dt {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.game-over-bot-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 1rem;
    font-weight: 800;
}

.game-over-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.game-over-actions.single-action {
    grid-template-columns: 1fr;
}

