* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: #0f1419;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-hover: rgba(255, 255, 255, 0.09);
    --text-primary: #ffffff;
    --text-secondary: #c5d1e0;
    --accent: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --offline: #64748b;
    --divider: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --bitcoin: #f7931a;
    --bitcoin-cash: #10b981;
    --ethereum: #8b5cf6;
    --litecoin: #60a5fa;
    --dogecoin: #fbbf24;
    --dash: #06b6d4;
    --purple: #a855f7;
    --teal: #14b8a6;
    --pink: #ec4899;
    --indigo: #6366f1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.25) 0%, transparent 45%),
        radial-gradient(circle at 80% 15%, rgba(139, 92, 246, 0.22) 0%, transparent 45%),
        radial-gradient(circle at 40% 70%, rgba(236, 72, 153, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.20) 0%, transparent 50%),
        radial-gradient(circle at 60% 50%, rgba(251, 191, 36, 0.15) 0%, transparent 50%);
    animation: float 25s ease-in-out infinite;
    z-index: -1;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(40px, -40px) rotate(8deg);
    }
    66% {
        transform: translate(-30px, 30px) rotate(-8deg);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 48px;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 60%, #e8dcc8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.last-updated {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.refresh-button {
    background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
    color: white;
    border: none;
    padding: 11px 28px;
    border-radius: 980px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.refresh-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.refresh-button:hover::before {
    left: 100%;
}

.refresh-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
}

.refresh-button:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.server-card {
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(70px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.8);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.25px solid rgba(255, 255, 255, 0.28);
    position: relative;
    overflow: hidden;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%);
    opacity: 1;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px currentColor;
}

.server-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(circle at 50% 0%, currentColor, transparent 60%);
    mix-blend-mode: soft-light;
}

.server-card:nth-child(1)::before,
.server-card:nth-child(1)::after { color: var(--bitcoin); }
.server-card:nth-child(2)::before,
.server-card:nth-child(2)::after { color: var(--bitcoin); }
.server-card:nth-child(3)::before,
.server-card:nth-child(3)::after { color: var(--bitcoin-cash); }
.server-card:nth-child(4)::before,
.server-card:nth-child(4)::after { color: var(--dash); }
.server-card:nth-child(5)::before,
.server-card:nth-child(5)::after { color: var(--indigo); }
.server-card:nth-child(6)::before,
.server-card:nth-child(6)::after { color: var(--dogecoin); }
.server-card:nth-child(7)::before,
.server-card:nth-child(7)::after { color: var(--purple); }
.server-card:nth-child(8)::before,
.server-card:nth-child(8)::after { color: var(--litecoin); }
.server-card:nth-child(9)::before,
.server-card:nth-child(9)::after { color: var(--pink); }
.server-card:nth-child(10)::before,
.server-card:nth-child(10)::after { color: var(--teal); }
.server-card:nth-child(11)::before,
.server-card:nth-child(11)::after { color: var(--ethereum); }

.server-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.9),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.03);
    border: 1.25px solid rgba(255, 255, 255, 0.35);
}

.server-card:hover::before {
    height: 4px;
    box-shadow: 0 0 30px currentColor;
}

.server-card:hover::after {
    opacity: 0.08;
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.server-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.server-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.server-region {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    opacity: 0.85;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 0 0 currentColor;
    animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

.status-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), currentColor);
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.status-indicator.online {
    color: var(--success);
}

.status-indicator.warning {
    color: var(--warning);
}

.status-indicator.error {
    color: var(--error);
}

.status-indicator.offline {
    color: var(--offline);
    animation: none;
}

.status-indicator.checking {
    color: var(--accent);
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 currentColor;
    }
    70% {
        box-shadow: 0 0 0 4px transparent;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.server-info {
    margin-bottom: 18px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--divider);
}

.info-row:hover {
    background: rgba(255, 255, 255, 0.05);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: var(--radius-sm);
}

.info-label {
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    letter-spacing: -0.01em;
}

.server-link {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, var(--accent) 0%, #0051d5 100%);
    color: white;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    margin-top: 16px;
    position: relative;
    overflow: hidden;
}

.server-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.server-link:hover::before {
    left: 100%;
}

.server-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.server-link:active {
    transform: scale(0.98);
}

.warning-message {
    background: rgba(251, 191, 36, 0.15);
    border-left: 3px solid var(--warning);
    color: #fcd34d;
    font-size: 0.8125rem;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.error-message {
    background: rgba(248, 113, 113, 0.15);
    border-left: 3px solid var(--error);
    color: #fca5a5;
    font-size: 0.8125rem;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.status-good {
    color: var(--success) !important;
    font-weight: 600 !important;
}

.status-bad {
    color: var(--error) !important;
    font-weight: 600 !important;
}

.status-online {
    color: var(--success) !important;
    font-weight: 600 !important;
}

.status-warning {
    color: var(--warning) !important;
    font-weight: 600 !important;
}

.status-error {
    color: var(--error) !important;
    font-weight: 600 !important;
}

.status-offline {
    color: var(--offline) !important;
    font-weight: 600 !important;
}

.status-checking {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

/* Smooth fade-in animation for cards on first load only */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.server-card.initial-load {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.server-card.initial-load:nth-child(1) { animation-delay: 0.05s; }
.server-card.initial-load:nth-child(2) { animation-delay: 0.1s; }
.server-card.initial-load:nth-child(3) { animation-delay: 0.15s; }
.server-card.initial-load:nth-child(4) { animation-delay: 0.2s; }
.server-card.initial-load:nth-child(5) { animation-delay: 0.25s; }
.server-card.initial-load:nth-child(6) { animation-delay: 0.3s; }
.server-card.initial-load:nth-child(7) { animation-delay: 0.35s; }
.server-card.initial-load:nth-child(8) { animation-delay: 0.4s; }
.server-card.initial-load:nth-child(9) { animation-delay: 0.45s; }
.server-card.initial-load:nth-child(10) { animation-delay: 0.5s; }
.server-card.initial-load:nth-child(11) { animation-delay: 0.55s; }

/* Data update animation */
@keyframes dataUpdate {
    0% {
        transform: scale(1) translateY(0);
        box-shadow: var(--shadow-sm);
    }
    40% {
        transform: scale(1.01) translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 122, 255, 0.12);
    }
    100% {
        transform: scale(1) translateY(0);
        box-shadow: var(--shadow-sm);
    }
}

.server-card.data-updated {
    animation: dataUpdate 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Field update highlight animation */
@keyframes fieldHighlight {
    0% {
        background: rgba(59, 130, 246, 0.3);
    }
    100% {
        background: transparent;
    }
}

.info-row.field-updated {
    animation: fieldHighlight 1.5s ease-out;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    header {
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .last-updated {
        margin-bottom: 16px;
    }

    .servers-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .server-card {
        padding: 14px 16px 18px 16px;
        cursor: pointer;
        user-select: none;
        position: relative;
    }

    .server-card:active {
        transform: scale(0.99);
    }

    .server-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    /* Put server name and region on same line for mobile */
    .server-title {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
    }

    .server-name {
        font-size: 1.125rem;
    }

    .server-region {
        font-size: 0.75rem;
    }

    .server-info {
        margin-bottom: 12px;
    }

    /* Hide all info rows except status by default on mobile */
    .server-card .info-row:not([data-field="status"]) {
        display: none;
    }

    /* Tighter spacing for collapsed cards */
    .server-card:not(.expanded) .info-row {
        padding: 6px 0;
    }

    /* Show all info rows when card is expanded */
    .server-card.expanded .info-row {
        display: flex;
    }

    /* Override desktop ::after and use for expand/collapse indicator - bottom center */
    .server-card::after {
        content: '▼' !important;
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%) scaleX(1.3);
        top: auto;
        right: auto;
        width: auto;
        height: auto;
        font-size: 0.6875rem;
        color: #c5d1e0 !important;
        opacity: 0.85 !important;
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 10;
        background: none !important;
        border-radius: 0;
        mix-blend-mode: normal !important;
    }

    .server-card.expanded::after {
        transform: translateX(-50%) scaleX(1.3) rotate(180deg);
    }

    .server-link {
        margin-bottom: 8px;
    }

    .server-link {
        margin-top: 12px;
        padding: 10px 14px;
        font-size: 0.875rem;
    }

    .info-row:hover {
        margin: 0;
        padding: 10px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
