:root {
    --primary: #10a37f;
    --primary-strong: #19c37d;
    --bg-base: #0b141a;
    --bg-surface: rgba(18, 24, 31, 0.78);
    --bg-surface-strong: rgba(14, 20, 26, 0.92);
    --bg-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-soft: #94a3b8;
    --text-dim: #6b7c93;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-xl: 0 12px 28px rgba(0, 0, 0, 0.18);
}

html {
    background: var(--bg-base);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(16, 163, 127, 0.08), transparent 30%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.06), transparent 28%),
        linear-gradient(180deg, #0b141a 0%, #0d151c 45%, #0b141a 100%);
    color: var(--text-main);
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background:
        radial-gradient(circle at 18% 20%, rgba(16, 163, 127, 0.14), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(14, 165, 233, 0.10), transparent 22%),
        radial-gradient(circle at 56% 78%, rgba(16, 163, 127, 0.08), transparent 26%);
    filter: blur(16px);
    opacity: 0.72;
    animation: ambientDrift 40s linear infinite alternate;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

body::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
    opacity: 0.12;
}

.ambient-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 140vw;
    height: 140vw;
    max-width: 900px;
    max-height: 900px;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='rgba(16,163,127,0.035)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M50 16c9 0 16 7 16 16v8H50c-9 0-16-7-16-16s7-16 16-16Z'/%3E%3Cpath d='M78 32c7 5 9 15 4 23l-4 7-14-8c-8-4-11-14-7-22 4-8 14-11 21-7Z'/%3E%3Cpath d='M80 64c-2 9-11 15-20 13l-8-2 4-15c2-9 11-15 20-13 9 2 15 11 13 17Z'/%3E%3Cpath d='M58 84c-8 5-19 3-24-5l-4-7 14-8c8-5 19-3 24 5 5 8 3 19-5 24Z'/%3E%3Cpath d='M28 76c-8-4-12-14-8-22l4-8 14 8c8 4 12 14 8 22-4 8-14 12-18 8Z'/%3E%3Cpath d='M22 44c1-9 9-17 18-17h8v16c0 9-8 17-17 17s-17-8-17-16Z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    z-index: 1;
    animation: watermarkSpin 160s linear infinite;
    will-change: transform;
}

@keyframes watermarkSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.ambient-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(48px);
    opacity: 0.1;
    animation: floatOrb 32s linear infinite;
    will-change: transform;
    contain: strict;
}

.ambient-orb-a {
    width: 260px;
    height: 260px;
    top: 6%;
    left: -6%;
    background: rgba(16, 163, 127, 0.9);
}

.ambient-orb-b {
    width: 220px;
    height: 220px;
    top: 12%;
    right: -8%;
    background: rgba(14, 165, 233, 0.7);
    animation-delay: -6s;
}

.ambient-orb-c {
    width: 300px;
    height: 300px;
    bottom: -14%;
    left: 45%;
    background: rgba(16, 163, 127, 0.5);
    animation-delay: -10s;
}

@keyframes ambientDrift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(1%, 1%, 0) scale(1.02); }
    100% { transform: translate3d(-1%, 1%, 0) scale(1.01); }
}

@keyframes floatOrb {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(10px, -8px, 0) scale(1.02); }
    100% { transform: translate3d(-8px, 6px, 0) scale(0.99); }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    .ambient-orb,
    .ambient-watermark {
        animation: none;
    }
}

/* ===== PERFORMANCE TIERS =====
   Low-end devices: disable heavy GPU effects to prevent frame drops
   Detected via hover: none (touch-only = likely mobile/low-end)
   and combined with low resolution check
*/
@media (max-width: 480px), (hover: none) and (max-width: 768px) {
    /* Disable the spinning watermark on low-end mobile */
    .ambient-watermark {
        animation: none !important;
        opacity: 0.5;
    }

    /* Reduce orb blur cost significantly */
    .ambient-orb {
        filter: blur(24px) !important;
        opacity: 0.07 !important;
    }

    /* Disable body::before animation */
    body::before {
        animation: none !important;
        filter: blur(8px) !important;
    }

    /* Disable grid pattern overlay on very small screens */
    body::after {
        display: none;
    }
}

/* Very low-end: completely disable all decorative layers */
@media (max-width: 360px) {
    .ambient-layer {
        display: none;
    }
    body::before,
    body::after {
        display: none;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0d1117;
}
::-webkit-scrollbar-thumb {
    background: rgba(16, 163, 127, 0.4);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 163, 127, 0.8);
}
.particle-network {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
