.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;

    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;

    animation: spin 0.7s linear infinite;
}

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

button:disabled {
    cursor: wait;
    opacity: 0.7;
}



.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    margin-bottom: 1.25rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
}

.status-dot {
    width: 0.75rem;
    height: 0.75rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 0.5rem currentColor;
    color: var(--status-color);
}

.connection-details {
    margin-bottom: 1.25rem;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.18);
}

.connection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.connection-row + .connection-row {
    margin-top: 0.5rem;
}

.connection-row p {
    margin: 0;
    overflow-wrap: anywhere;
    color: #94a3b8;
    font-size: 0.9rem;
}

.connection-row p span {
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 600;
}

.connection-row .copy-button {
    width: auto;
    margin: 0;
    padding: 0.3rem 0.65rem;
    white-space: nowrap;
    font-size: 0.8rem;
}

.autoShutdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.18);
}

.shutdown {
    min-width: 0;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.reset-timer-button {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 0.3rem 0.6rem;
    border-color: rgba(148, 163, 184, 0.45);
    background-color: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    white-space: nowrap;
    font-size: 0.78rem;
}

.reset-timer-button:hover:not(:disabled) {
    border-color: rgba(148, 163, 184, 0.7);
    background-color: rgba(148, 163, 184, 0.22);
}

#games > section:not([data-state="running"]) .autoShutdown {
    display: none;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 1.5rem;
    align-items: stretch;
    width: min(100%, 900px);
}

#games > section {
    --status-color: #94a3b8;

    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(18, 21, 27, 0.92), rgba(32, 38, 48, 0.92));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    color: #e2e8f0;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

#games > section::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background-color: var(--status-color);
    box-shadow: 0 0 14px var(--status-color);
    content: "";
}

#games > section:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32);
}

#games > section[data-state="running"] {
    --status-color: #22c55e;
}

#games > section[data-state="created"],
#games > section[data-state="restarting"] {
    --status-color: #eab308;
}

#games > section[data-state="paused"] {
    --status-color: #f97316;
}

#games > section[data-state="dead"],
#games > section[data-state="removing"] {
    --status-color: #ef4444;
}

#games > section h2 {
    margin-bottom: 0.75rem;
    color: #f8fafc;
}

#games > section .server-button {
    width: 100%;
    margin-top: auto;
    margin-bottom: 0;
}

#games > section[data-state="running"] .server-button {
    border-color: #dc2626;
    background-color: #dc2626;
}

#games > section[data-state="running"] .server-button:hover:not(:disabled) {
    border-color: #ef4444;
    background-color: #ef4444;
}

@media (prefers-reduced-motion: reduce) {
    #games > section {
        transition: none;
    }

    #games > section:hover {
        transform: none;
    }
}
