.app-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(90vw, 420px);
    pointer-events: none;
}

/* Toast nel tema noir: fondo scuro, bordo e icona del colore dell'esito. */
.app-toast {
    --toast-accent: #c2a46d;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border-radius: 0.8rem;
    padding: 0.8rem 0.85rem 0.8rem 1rem;
    background: linear-gradient(145deg, rgba(22, 24, 29, 0.97), rgba(10, 11, 15, 0.97));
    color: #f1eadc;
    border: 1px solid color-mix(in srgb, var(--toast-accent) 55%, transparent);
    border-left: 4px solid var(--toast-accent);
    box-shadow: 0 0.9rem 2rem rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    font-family: "Inter", sans-serif;
    font-size: 0.92rem;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease;
    pointer-events: auto;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast::before {
    font-family: "bootstrap-icons", sans-serif;
    color: var(--toast-accent);
    font-size: 1.05rem;
    line-height: 1.3;
    flex-shrink: 0;
}

.app-toast-message {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-toast-success {
    --toast-accent: #5fbf9f;
}

.app-toast-success::before {
    content: "\F26A"; /* bi-check-circle-fill */
}

.app-toast-error {
    --toast-accent: #e0707f;
}

.app-toast-error::before {
    content: "\F33A"; /* bi-exclamation-circle-fill */
}

.app-toast-info {
    --toast-accent: #c2a46d;
}

.app-toast-info::before {
    content: "\F430"; /* bi-info-circle-fill */
}

.app-toast-close {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    margin: -0.2rem -0.2rem 0 0;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: rgba(241, 234, 220, 0.7);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

@media (prefers-reduced-motion: reduce) {
    .app-toast {
        transition: none;
        transform: none;
    }
}

/* Aggiornamenti in attesa mentre si compila un modulo (game.js). */
.updates-pending-bar {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.6rem 0.75rem 0.6rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(194, 164, 109, 0.55);
    border-left: 4px solid #c2a46d;
    background: linear-gradient(145deg, rgba(22, 24, 29, 0.97), rgba(10, 11, 15, 0.97));
    color: #f1eadc;
    box-shadow: 0 0.9rem 2rem rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
}

.updates-pending-close {
    flex: none;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 .25rem;
    opacity: .8;
}

.updates-pending-close:hover,
.updates-pending-close:focus-visible {
    opacity: 1;
}

/* Su telefono sta sopra la barra di navigazione in basso. */
@media (max-width: 991.98px) {
    .updates-pending-bar {
        bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    }
}
