body {
    background-color: #000;
    color: #d1d1d1;
    font-family: 'Geist Mono', monospace;
    margin: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    overflow: hidden;
    user-select: none;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(to bottom,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.08) 2px,
            rgba(0, 0, 0, 0.08) 4px);
    pointer-events: none;
    z-index: 9999;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
    pointer-events: none;
    z-index: 9998;
}

body.page-loaded #main-ui {
    opacity: 1;
    transform: translateY(0);
}

#main-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px;
    box-sizing: border-box;
    transition:
        filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.5s ease,
        transform 0.5s ease;
    opacity: 0;
    transform: translateY(8px);
    z-index: 10;
}

/* Discover Search Layout */
.discover-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 500px;
    max-width: 100%;
}

.searxng-logo-wrapper {
    width: 284px;
    margin-bottom: 30px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.15));
}

.searxng-logo-wrapper svg {
    display: block;
    width: 100%;
    height: auto;
}

.searxng-logo-wrapper svg rect {
    fill: #ffffff;
    animation: led-flicker 4s infinite alternate;
}

@keyframes led-flicker {
    0%, 100% { opacity: 0.95; }
    45% { opacity: 0.98; }
    50% { opacity: 0.85; } /* subtle flicker */
    52% { opacity: 0.95; }
    80% { opacity: 0.98; }
}

.search-form {
    width: 100%;
}

.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 0 18px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}

.search-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(25, 25, 25, 0.75);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.03);
}

#search-input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    color: #ffffff;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    outline: none;
    padding: 0;
    margin: 0;
}

#search-input::placeholder {
    color: #555555;
    transition: color 0.3s;
}

.search-wrapper:focus-within #search-input::placeholder {
    color: #6a6a6a;
}

.search-button {
    height: 100%;
    border: none;
    background: transparent;
    color: #555555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 10px;
    transition: color 0.2s, transform 0.1s;
    outline: none;
}

.search-button:hover {
    color: #ffffff;
}

.search-button:active {
    transform: scale(0.92);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    padding: 8px;
    display: flex;
    gap: 5px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

body.page-loaded .bottom-nav {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-item {
    color: #888;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 50px;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.08);
}

/* Glitch Exit Animation */
@keyframes glitch-out {
    0% {
        opacity: 1;
        transform: none;
        filter: none;
    }

    15% {
        opacity: 1;
        transform: skewX(-3deg);
        filter: brightness(1.5);
    }

    20% {
        opacity: 0.8;
        transform: translateX(-4px) skewX(2deg);
        filter: hue-rotate(90deg) brightness(2);
    }

    25% {
        opacity: 1;
        transform: translateX(4px);
        filter: none;
    }

    30% {
        opacity: 0.6;
        transform: skewX(-5deg);
        filter: hue-rotate(-90deg);
    }

    40% {
        opacity: 0;
        transform: translateY(3px);
        filter: blur(2px);
    }

    100% {
        opacity: 0;
    }
}

body.glitch-exit #main-ui {
    animation: glitch-out 0.4s forwards;
}

/* Discord Modal */
#discord-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    width: 600px;
    max-width: calc(100% - 40px);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85);
}

.presence-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    color: #e6e6e6;
}

.presence-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.presence-row {
    display: flex;
    gap: 18px;
    align-items: center;
}

.presence-avatar-wrapper {
    width: 74px;
    height: 74px;
    border-radius: 20px;
    background: #5865f2;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.presence-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.presence-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.presence-handle {
    font-size: 16px;
    color: #ffffff;
    font-weight: 700;
}

.presence-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #43b581;
    display: inline-block;
}

.presence-status {
    font-size: 12px;
    color: #888888;
}

.presence-close {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: #f4f4f4;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.presence-close:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.presence-card {
    display: flex;
    gap: 24px;
    align-items: stretch;
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 4px;
}

.presence-card-art {
    flex: 1 1 50%;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    min-height: 120px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.presence-card-label {
    font-size: 10px;
    color: #888888;
    letter-spacing: 0.15em;
    font-weight: 700;
}

.presence-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.presence-card-subtitle {
    font-size: 12px;
    color: #888888;
}

.presence-card-meta {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    padding: 0 10px;
}

.presence-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 8px;
    color: #dddddd;
    font-size: 12px;
}

.presence-meta-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.presence-meta-label {
    font-size: 11px;
    color: #666666;
    letter-spacing: 0.05em;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#grid-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
}


/* Mobile Nav Fix */
@media (max-width: 600px) {
    .bottom-nav {
        bottom: 20px !important;
        padding: 6px !important;
        gap: 2px !important;
        width: calc(100% - 24px) !important;
        max-width: 380px !important;
        justify-content: space-between !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(0) !important;
    }
    .nav-item {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}
