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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
    color: #e8e8e8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

body {
    display: flex;
}

/* Sidebar */
#sidebar {
    width: 280px;
    flex-shrink: 0;
    height: 100%;
    background: #111;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#sidebar header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

#sidebar header .subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 2px;
}

.check, .radio {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.check input, .radio input {
    accent-color: #fff;
    cursor: pointer;
}

.slider {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.slider input[type="range"] {
    width: 100%;
    accent-color: #fff;
}

#search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
}

#search:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.09);
}

#details-panel {
    min-height: 80px;
}

#details.details-empty {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-style: italic;
}

#details h3 {
    font-size: 15px;
    margin-bottom: 6px;
}

#details p {
    margin-bottom: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

#details a {
    color: #8ab4ff;
    text-decoration: none;
}

#details a:hover {
    text-decoration: underline;
}

#details .bio {
    color: rgba(255, 255, 255, 0.55);
    font-style: italic;
}

#details .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}

.chip {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

#legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.backlink {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.backlink a {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    text-decoration: none;
}

.backlink a:hover {
    color: #fff;
}

/* Graph area */
#graph-container {
    position: relative;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

#graph {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#graph:active {
    cursor: grabbing;
}

#graph-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

#graph-controls button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#graph-controls button:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.08);
}

/* SVG node + link styles */
.link {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-linecap: round;
    transition: stroke 0.2s ease, stroke-opacity 0.2s ease;
}

.link.type-collab {
    stroke: rgba(255, 180, 120, 0.45);
}

.link.type-follow {
    stroke: rgba(130, 200, 255, 0.38);
}

.link.type-category {
    stroke: rgba(255, 255, 255, 0.14);
}

.link.dim {
    stroke-opacity: 0.05;
}

.node circle {
    stroke: #0a0a0a;
    stroke-width: 1.5;
    cursor: pointer;
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.node:hover circle {
    stroke: #fff;
    stroke-width: 2;
}

.node.active circle {
    stroke: #fff;
    stroke-width: 2.5;
}

.node.dim {
    opacity: 0.15;
}

.node text.label {
    font-size: 10px;
    fill: rgba(255, 255, 255, 0.7);
    text-anchor: middle;
    pointer-events: none;
    font-family: inherit;
}

.node:hover text.label,
.node.active text.label {
    fill: #fff;
    font-weight: 600;
}

#graph-status {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 16px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    max-width: 480px;
    text-align: center;
    z-index: 20;
}

#graph-status.hidden {
    display: none;
}

#graph-status code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', Menlo, monospace;
}

/* Responsive */
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        max-height: 45%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    #graph-container {
        flex: 1;
        min-height: 55%;
    }
}
