:root {
    --bg: #0a0a0a;
    --fg: #e5e5e5;
    --border: #333;
    --accent: #3b82f6;
    --hover: #1f1f1f;
    --danger: #ef4444;
    --card-bg: #111;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
}

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

body.nullvuild-theme {
    background: var(--bg) !important;
    color: var(--fg) !important;
    font-family: var(--font) !important;
    line-height: 1.6;
}

/* ── Global Links ── */
a {
    color: var(--accent);
    text-decoration: none !important;
    transition: 0.2s;
}

a:hover, a:focus {
    text-decoration: none !important;
    opacity: 0.8;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 999px; }

/* ── Header & Navigation ── */
.main-header {
    background: #000 !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 12px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -1px;
    font-family: monospace;
    flex-shrink: 0;
}
.logo:hover { text-decoration: none !important; }
.logo .null { color: #fff; }
.logo .vuild { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: #888 !important;
    text-decoration: none;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a i { font-size: 16px; }
.nav-links a:hover { color: var(--fg) !important; text-decoration: none; }

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-bar {
    background: #111 !important;
    border: 1px solid #333 !important;
    color: #fff !important;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    width: 150px;
    outline: none;
    font-family: monospace;
    transition: width 0.3s ease-in-out, border-color 0.3s;
}

.search-bar:focus {
    width: 250px;
    border-color: var(--accent) !important;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-actions a:not(.btn), .user-actions button:not(.btn) {
    color: #888 !important;
    font-size: 18px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s;
    display: flex;
    align-items: center;
}

.user-actions a:not(.btn):hover, .user-actions button:not(.btn):hover { color: var(--fg) !important; }

/* ── Mobile Optimization ── */
@media (max-width: 1000px) {
    .main-header { padding: 10px 15px !important; }
    .header-left { gap: 15px !important; }
    .nav-links { gap: 12px !important; }
    .nav-links a span, .search-container, .governance-info { display: none !important; }
    .nav-links a i { font-size: 20px !important; }
    .header-right { gap: 12px !important; }
    .user-actions { gap: 12px !important; }
    .user-actions a, .user-actions button { font-size: 20px !important; }
}

/* ── Cards & Elements ── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    color: inherit;
    text-decoration: none;
    display: block;
    transition: 0.2s;
}

.card:hover {
    border-color: var(--accent);
    background: #161616;
}

.card h1, .card h2, .card h3 { color: var(--fg); margin-bottom: 10px; }

.btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #000;
    color: var(--fg);
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

.btn.primary { background: var(--accent); color: #fff; border: none; }
.btn.primary:hover { background: #2563eb; color: #fff !important; opacity: 1; }
.btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(59, 130, 246, 0.05); }

/* ── Markdown Viewer ── */
.markdown-body {
    line-height: 1.8;
    color: var(--fg);
    overflow-wrap: break-word;
    word-break: break-word;
}

.markdown-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: none;
}

.markdown-body a:hover {
    text-decoration: none;
    opacity: 0.8;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin: 1.5em 0 1em;
    color: var(--fg);
}

.markdown-body pre {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-left: 3px solid var(--accent);
    padding: 15px;
    overflow-x: auto;
    font-family: monospace;
    margin: 1em 0;
}

.markdown-body code {
    font-family: monospace;
    background: #111;
    border: 1px solid #2e2e2e;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--accent);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #222;
    padding: 10px;
    text-align: left;
}

/* ── Knowledge List (High-Density) ── */
.hd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.hd-table thead tr {
    background: #111;
    border-bottom: 1px solid #222;
    text-align: left;
    color: #888;
}

.hd-table th, .hd-table td {
    padding: 12px 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-row {
    border-bottom: 1px solid #111;
    transition: background 0.1s;
    cursor: pointer;
}

.hd-row:hover {
    background: #0f0f0f !important;
}

.hd-row.pinned {
    background: rgba(59, 130, 246, 0.05);
}

.hd-row.pinned:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.hd-title {
    font-weight: bold;
    font-size: 14px;
    color: var(--fg);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-row.pinned .hd-title {
    color: var(--accent);
}

.hd-meta {
    font-size: 11px;
    color: #555;
    display: block;
}

.hd-metrics {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: monospace;
    font-size: 11px;
}

@media (max-width: 768px) {
    .hd-table th:nth-child(2), .hd-table td:nth-child(2),
    .hd-table th:nth-child(3), .hd-table td:nth-child(3) {
        display: none;
    }
    .hd-table th:nth-child(1) { width: 70%; }
}
