:root {
    --bg: #060909;
    --surface: #090d0d;
    --surface-2: #0c1111;
    --border: rgba(255, 255, 255, 0.10);
    --grid: rgba(45, 212, 163, 0.055);
    --accent: #2dd4a3;
    --accent-soft: rgba(45, 212, 163, 0.12);
    --text: #f3f5f4;
    --muted: #7e8988;
    --error: #ff5555;
    --error-bg: rgba(255, 85, 85, 0.1);
    
    --font-heading: 'Inter', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'JetBrains Mono', Consolas, monospace;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    background-image: 
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 72px 72px;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-heading);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* DECORATIVE TOPOLOGY (Pure CSS) */
body::before {
    content: '';
    position: fixed;
    top: 10%;
    right: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 60%);
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

header {
    display: flex;
    justify-content: space-between;
    padding: 24px 32px;
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.1em;
}

.brand {
    color: var(--text);
    text-transform: uppercase;
}

.status {
    color: var(--muted);
}
.status.connected {
    color: var(--accent);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.eyebrow {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.15em;
    margin-bottom: 24px;
    text-transform: uppercase;
}

/* UI UTILITIES */
.flex-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lucide {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

h1 .lucide {
    width: 24px;
    height: 24px;
}
.brand .lucide, .eyebrow .lucide, .modal-title .lucide {
    width: 18px;
    height: 18px;
}

.spin {
    animation: spin 1s linear infinite;
}

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

h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    margin: 0 0 32px 0;
    letter-spacing: -0.02em;
}

h1 .solid {
    display: block;
    color: var(--text);
}

h1 .outline {
    display: block;
    color: transparent;
    -webkit-text-stroke: 1px var(--accent);
}

.description {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 48px;
}

.search-container {
    display: flex;
    max-width: 800px;
    gap: 16px;
}

.search-input {
    flex: 1;
    background: #050808;
    border: 1px solid var(--border);
    padding: 16px 24px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 16px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-soft);
}

.btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 16px 32px;
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: bold;
}

.btn-primary:hover {
    background: #39e3b1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.system-message {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--error);
    background: var(--error-bg);
    color: var(--error);
    font-family: var(--font-mono);
    font-size: 13px;
    display: none;
    max-width: 800px;
    box-sizing: border-box;
}

/* MODAL */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    width: min(1000px, 88vw);
    height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(16px);
    transition: transform 0.2s ease;
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 14px;
}

.modal-title {
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
}
.modal-close:hover {
    color: var(--accent);
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1px; /* border offset */
    background: #050808;
    overflow: hidden;
}

.editor-textarea {
    flex: 1;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    padding: 16px;
    box-sizing: border-box;
    resize: none;
    outline: none;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.editor-textarea:focus {
    outline: none;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12px;
}

.file-meta {
    color: var(--muted);
    letter-spacing: 0.1em;
}

.modal-actions {
    display: flex;
    gap: 16px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    header {
        padding: 16px;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .modal {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
    }

    .modal-header, .modal-footer {
        padding: 12px 16px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .file-meta {
        justify-content: center;
    }
    
    .modal-actions {
        width: 100%;
        gap: 8px;
    }

    .modal-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .btn {
        padding: 12px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
