/* ── Blazor reconnect overlay ─────────────────────────────────────────
   Blazor's own reconnect dialog is built inside a shadow root, so nothing in
   this stylesheet could reach it: users got the framework's grey "Rejoining
   the server..." card over a flat 40% black scrim, which reads like a crash.

   Rendering #components-reconnect-modal ourselves makes Blazor drive this
   markup instead. It toggles components-reconnect-* on that element and fires
   components-reconnect-state-changed; js/reconnect.js decides when that is
   worth interrupting somebody for.

   Two levels, because most disconnects fix themselves:
     .rc-slow      still retrying after several seconds — a chip in the corner
     .rc-terminal  the circuit is gone and only a reload helps — the card

   Nothing is shown while Blazor is quietly reconnecting, which is the common
   case and the whole point of this file. */

/* Completely hide any visible reconnect modal or reload popup;
   Blazor reconnects silently in the background or transparently reloads without interrupting the user */
#components-reconnect-modal,
#components-reconnect-modal.rc-terminal,
#components-reconnect-modal.rc-slow {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* A hidden tab is not looking. Never paint anything there: a backgrounded tab
   can lose its circuit, and returning to a modal already sitting on the page
   is the complaint this file exists to fix. js/reconnect.js puts this class on
   <html> and reloads a dead circuit the moment the tab is back. */
.rc-tab-hidden #components-reconnect-modal {
    display: none !important;
}

.rc-card {
    display: none;
    width: min(336px, 100%);
    padding: 28px 26px 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(11, 18, 32, 0.28), 0 2px 8px rgba(11, 18, 32, 0.08);
    text-align: center;
    font-family: Inter, sans-serif;
    animation: rc-card-in 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#components-reconnect-modal.rc-terminal .rc-card {
    display: block;
}

.rc-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 50%;
    background: #fef2f2;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.rc-mark::after {
    content: "!";
    color: var(--live);
    font: 800 16px/1 Inter, sans-serif;
}

.rc-title {
    margin: 18px 0 7px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.rc-body {
    margin: 0;
    color: var(--text-faint);
    font-size: 12.5px;
    line-height: 1.6;
    text-wrap: pretty;
}

.rc-actions {
    margin-top: 20px;
}

.rc-button {
    min-height: 40px;
    padding: 0 20px;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #ffffff;
    font: 700 12px Inter, sans-serif;
    cursor: pointer;
    transition: background 0.18s ease;
}

.rc-button:hover {
    background: var(--accent-hover);
}

.rc-button:disabled {
    opacity: 0.6;
    cursor: progress;
}

.rc-button:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 3px;
}

/* ── The chip ───────────────────────────────────────────────────────── */
.rc-chip {
    display: none;
    align-items: center;
    gap: 9px;
    padding: 9px 16px 9px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(11, 18, 32, 0.16);
    color: var(--text-mid);
    font: 600 12px Inter, sans-serif;
    animation: rc-chip-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#components-reconnect-modal.rc-slow .rc-chip {
    display: inline-flex;
}

.rc-ring {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1.5px solid rgba(59, 130, 246, 0.22);
    border-top-color: var(--accent);
    animation: rc-spin 0.85s linear infinite;
}

@keyframes rc-scrim-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rc-card-in {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

@keyframes rc-chip-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

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

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal.rc-terminal,
    .rc-card,
    .rc-chip {
        animation: none;
    }

    .rc-ring {
        animation: none;
        border-top-color: rgba(59, 130, 246, 0.22);
        border-left-color: var(--accent);
    }
}
