/* Existing Styles */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    background-color: #0c1015;
    /* 深色画布：关系图本身保持原有配色，只把外框换成站点风格 */
    color: #dde3e9;
}

#background-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 44%, #151c24 0%, #0c1015 100%);
    z-index: -1;
}

#canvas-container {
    width: 100%;
    height: 100%;
}

/* Floating UI Elements */
.floating-ui {
    position: absolute;
    background: rgba(15, 20, 26, 0.88);
    backdrop-filter: blur(12px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    padding: 14px 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.top-bar {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;
    width: 94%;
    max-width: 1120px;
    justify-content: space-between;
}

.branding h1 {
    margin: 0;
    font-family: "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC",
        "Songti SC", Georgia, serif;
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #f2f5f7;
}

.gold-text {
    color: #8fbf3a;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e6eaee;
    padding: 7px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.24);
}

button.active {
    background: rgba(118, 185, 0, 0.16);
    border-color: rgba(118, 185, 0, 0.55);
    color: #b6d97a;
}

/* Layout Switcher */
.layout-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 3px;
    padding: 2px;
    gap: 2px;
}

.layout-switcher button {
    background: transparent;
    border: none;
    padding: 5px 10px;
    font-size: 0.82rem;
    border-radius: 2px;
}

.layout-switcher button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.layout-switcher button.active {
    background: rgba(118, 185, 0, 0.18);
    color: #cbe6a0;
    font-weight: 600;
}


/* Search */
.search-container {
    position: relative;
}

#search-input {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e6eaee;
    padding: 7px 12px;
    border-radius: 3px;
    width: 200px;
    font-family: inherit;
    font-size: 0.85rem;
}

#search-input:focus {
    outline: none;
    border-color: rgba(118, 185, 0, 0.6);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #121820;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
}

.search-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Legend */
.bottom-left {
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.79rem;
    letter-spacing: 0.02em;
    color: #aeb9c4;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.layer-1 {
    background: #ff6b6b;
}

.layer-people {
    background: #ffd93d;
}

.layer-3 {
    background: #4d96ff;
}

.layer-2 {
    background: #6bcb77;
}

.layer-4 {
    background: #ff9a3c;
}

/* Settings Modal */
#settings-modal {
    top: 80px;
    right: 20px;
    width: 250px;
}

#settings-modal h3 {
    margin-top: 0;
    font-family: "Noto Serif CJK SC", "Noto Serif SC", "Songti SC", Georgia, serif;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #ccc;
}

.radio-group {
    display: flex;
    gap: 10px;
}

/* Insights Panel */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: rgba(13, 18, 24, 0.96);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
    transition: transform 0.3s ease-in-out;
}

.side-panel.hidden {
    transform: translateX(100%);
    display: flex;
    /* Keep flex to maintain structure when sliding out */
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    margin: 0;
    font-family: "Noto Serif CJK SC", "Noto Serif SC", "Songti SC", Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f2f5f7;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
    padding: 0;
}

.close-btn:hover {
    color: #fff;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Insight Cards */
.insight-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.insight-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.3);
}

.insight-card.active {
    border-color: rgba(118, 185, 0, 0.55);
    background: rgba(118, 185, 0, 0.06);
}

.insight-card h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #fff;
}

.insight-card p {
    margin: 0;
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.4;
}

/* Utilities */
.hidden {
    display: none;
}

/* Added for rolling-site integration */
.branding {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.top-bar .nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar .nav-link {
    color: #a9b5c1;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border-radius: 2px;
    border: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.top-bar .nav-link:hover {
    color: #eef2f5;
    border-color: rgba(255, 255, 255, 0.18);
    background: transparent;
}

.top-bar .nav-link.active {
    color: #dcead0;
    background: transparent;
    border-color: rgba(118, 185, 0, 0.5);
    font-weight: 600;
}

.layer-company {
    background: #6bcb77;
}

.layer-org {
    background: #4d96ff;
}

.layer-place {
    background: #ff9a3c;
}

.layer-policy {
    background: #ff6b6b;
}

.layer-other {
    background: #a78bfa;
}

.legend-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 2px 0;
}

.line-sample {
    width: 18px;
    height: 0;
    display: inline-block;
    border-top: 2px solid #9aa4b2;
}

.line-dashed {
    border-top-style: dashed;
    border-top-color: #FFD700;
}

.line-denied {
    border-top-color: #888888;
}

.panel-title-wrap {
    min-width: 0;
}

.panel-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.panel-badge {
    display: inline-block;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    padding: 1px 8px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    color: #c3ccd5;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.panel-days {
    font-size: 0.8rem;
    color: #aaa;
}

.panel-actions {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.open-page-btn {
    display: inline-block;
    background: rgba(118, 185, 0, 0.9);
    color: #0d1208;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    padding: 6px 14px;
    border-radius: 2px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.open-page-btn:hover {
    opacity: 0.88;
}

.rel-section-title {
    font-size: 0.85rem;
    color: #9aa4b2;
    margin: 0 0 12px 0;
}

.rel-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.rel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.rel-label {
    color: #FFD700;
    font-weight: 600;
}

.rel-dir {
    color: #888;
    font-size: 0.82rem;
}

.rel-peer-link {
    color: #7cc4ff;
    text-decoration: none;
    font-weight: 600;
}

.rel-peer-link:hover {
    text-decoration: underline;
}

.rel-status {
    margin-left: auto;
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.rel-status-reported {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd93d;
}

.rel-status-denied {
    background: rgba(136, 136, 136, 0.25);
    color: #aaa;
}

.ev-item {
    font-size: 0.82rem;
    color: #c7cdd6;
    line-height: 1.5;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 6px;
}

.ev-cite {
    color: #7cc4ff;
    text-decoration: none;
    font-weight: 600;
    margin-left: 2px;
}

.ev-cite:hover {
    text-decoration: underline;
}

.empty-rel {
    font-size: 0.88rem;
    color: #888;
}

@media (max-width: 768px) {
    .top-bar {
        flex-wrap: wrap;
        gap: 10px;
        width: calc(100% - 24px);
        padding: 10px 12px;
    }

    .controls {
        flex-wrap: wrap;
        width: 100%;
    }

    #search-input {
        width: 150px;
    }

    .side-panel {
        width: 100%;
        max-width: 340px;
    }
}