/* Blazor owns the state classes and retry timing. Only the notice is delayed. */
#components-reconnect-modal {
    display: none;
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 2rem);
    z-index: 9999;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected,
#components-reconnect-modal.components-reconnect-startup-failed {
    display: block;
}

/* Removing the show class cancels the reveal, including during navigation.
   A new interruption gets its own full three seconds. Hidden content cannot take focus. */
#components-reconnect-modal.components-reconnect-show {
    visibility: hidden;
    animation: reconnect-reveal 0s linear 3s forwards;
}

#components-reconnect-modal .reconnect-show,
#components-reconnect-modal .reconnect-failed,
#components-reconnect-modal .reconnect-rejected,
#components-reconnect-modal .reconnect-startup-failed {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .reconnect-show,
#components-reconnect-modal.components-reconnect-failed .reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-rejected,
#components-reconnect-modal.components-reconnect-startup-failed .reconnect-startup-failed {
    display: block;
}

.reconnect-card {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    min-width: min(15rem, calc(100vw - 2rem));
    max-width: 22rem;
    padding: 0.75rem 0.9375rem;
    border: 1px solid var(--gp-border, #dfd9cd);
    border-radius: 0.625rem;
    background: var(--gp-surface, #fffefa);
    color: var(--gp-foreground, #29251e);
    box-shadow: 0 6px 24px rgba(30, 30, 30, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: left;
}

.reconnect-card p {
    margin: 0;
    overflow-wrap: anywhere;
}

.reconnect-btn {
    min-height: 2rem;
    margin-left: auto;
    border: 1px solid var(--gp-border, #dfd9cd);
    border-radius: 0.4375rem;
    padding: 0.25rem 0.625rem;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.reconnect-btn:hover {
    background: var(--gp-surface-hover, #f0eee8);
}

.reconnect-spinner {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gp-border, #dfd9cd);
    border-top-color: var(--gp-success, #286648);
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
}

@keyframes reconnect-reveal {
    to { visibility: visible; }
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    /* Preserve the three-second reveal; only the decorative spinner stops. */
    .reconnect-spinner { animation: none; }
}

@media (pointer: coarse) {
    .reconnect-btn { min-height: 2.75rem; }
}
