/* 因果星空 - 3D 视觉实现 CSS */
/* 阶段一：逻辑建模期 · 骨架与巡航 */

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-image: url('/static/images/bg2.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 遮罩层：深色半透明覆盖与柔和聚光效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 径向渐变：中心透明/微亮，边缘深黑，实现柔和的聚光遮罩效果（整体压暗） */
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0.98) 100%);
    z-index: -1;
}

/* 辅助遮罩层：左下角柔和聚光，增加星空自然感 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 径向渐变：左下角微亮，向外逐渐透明，模拟星云或远处光源 */
    background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 30%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}


#3d-graph {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 当抽屉打开时，画布向左移动384px（与抽屉等宽） */
.drawer:not(.drawer-hidden) ~ #3d-graph {
    left: -384px;
}

/* 调整UI覆盖层的位置，使其与画布一起移动 */
.drawer:not(.drawer-hidden) ~ #ui-overlay {
    left: -384px;
}

/* 当抽屉打开时，隐藏搜索图标按钮（#btn-toggle-search）；抽屉关闭时，显示搜索图标按钮 */
.drawer:not(.drawer-hidden) ~ #ui-overlay #search-panel #btn-toggle-search.search-toggle {
    display: none !important;
}

.drawer.drawer-hidden ~ #ui-overlay #search-panel #btn-toggle-search.search-toggle {
    display: flex !important;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#header {
    position: absolute;
    top: 20px;
    left: 40px;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 20px;
    pointer-events: auto;
}

#header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #60a5fa;
    letter-spacing: 1px;
}

#header .subtitle {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #94a3b8;
}

#controls {
    position: fixed;
    bottom: 20px;
    left: 40px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1999;
}

/* 望远镜控制面板 */
#telescope-panel {
    position: fixed;
    /* 48*3 + 10*2 + controls bottom 20 + 安全间距 18，确保永远在整列 control 上方 */
    bottom: 202px;
    left: 40px;
    background: transparent;
    border: none;
    padding: 0;
    pointer-events: auto;
    z-index: 1999;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.telescope-slider {
    -webkit-appearance: none;
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 8px;
    height: 190px;
    background-color: transparent !important;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(60, 140, 255, 0.2);
}

.telescope-slider::-webkit-slider-runnable-track {
    width: 2px;
    height: 190px;
    border-radius: 999px;
    background: transparent;
    border: none;
}

.telescope-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #888888;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    margin-left: -5px;
}

.telescope-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #666666;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.telescope-slider::-moz-range-track {
    width: 2px;
    height: 190px;
    border-radius: 999px;
    background: transparent;
    border: none;
}

.telescope-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #888888;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

/* 屏幕中央瞄准刻度 */
#telescope-reticle {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#telescope-reticle:not(.hidden) {
    opacity: 1;
}

.reticle-scale {
    width: 400px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reticle-track {
    position: relative;
    width: 380px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.reticle-tick {
    position: absolute;
    top: 50%;
    width: 1px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.reticle-tick-center {
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
}

.reticle-thumb {
    position: absolute;
    left: 0%;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%);
    transition: left 0.08s linear;
    z-index: 10;
}

.reticle-value {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 13px;
    border-radius: 8px;
    font-family: 'Monaco', monospace;
}

/* 深空闪烁特效层 */
#cosmic-flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5; /* 在画布之上，UI之下 */
    background: radial-gradient(circle at center, rgba(96, 165, 250, 0.15) 0%, rgba(14, 165, 233, 0.05) 40%, transparent 80%);
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    mix-blend-mode: screen;
}

.cosmic-flash-active {
    opacity: 1 !important;
    transition: opacity 0.1s ease-out !important;
}

/* 星际导航盘容器 */
#nav-container {
    position: fixed;
    bottom: 20px;
    right: 10px;
    z-index: 1999;
    pointer-events: auto;
    width: 48px;
    height: 48px;
    transition: opacity 0.3s ease;
}

/* 拖拽/折叠控制按钮 */
#nav-toggle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #f59e0b; /* 默认使用与寻龙按钮类似的颜色 */
    cursor: grab;
    backdrop-filter: blur(10px);
    user-select: none;
    transition: all 0.3s ease;
}

#nav-toggle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

#nav-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(96, 165, 250, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

/* 展开状态下的按钮样式 */
#nav-container:not(.is-collapsed) #nav-toggle {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

#nav-container:not(.is-collapsed) #nav-toggle:hover {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    border-color: rgba(56, 189, 248, 0.8);
}

/* 星际导航盘主体 */
#nav-pad {
    position: absolute;
    bottom: 58px; /* 48px (toggle height) + 10px (gap) */
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1), inset 0 0 15px rgba(56, 189, 248, 0.1);
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right; /* 从右下角展开 */
}

#nav-pad.collapsed {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

#nav-pad:not(.collapsed):hover {
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.2), inset 0 0 20px rgba(56, 189, 248, 0.2);
}

.nav-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    color: #38bdf8;
    font-size: 18px;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
}

.nav-btn.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.nav-btn:not(.empty):hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
    color: #fff;
    transform: scale(1.05);
}

.nav-btn:not(.empty):active {
    background: rgba(56, 189, 248, 0.4);
    transform: scale(0.95);
}

.nav-center {
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.4);
    font-size: 22px;
}

.control-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.control-icon:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(96, 165, 250, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.control-icon:active {
    transform: scale(0.95);
}

.control-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

@media (hover: hover) {
    .control-icon:hover::after,
    #nav-toggle:hover::after {
        opacity: 1;
    }
}

#nav-toggle::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.icon-zoom {
    color: #60a5fa;
    font-size: 20px;
    font-weight: bold;
}

.icon-compass {
    color: #10b981;
    font-size: 20px;
    font-weight: bold;
}

.icon-dragon {
    color: #f59e0b;
    font-size: 20px;
    font-weight: bold;
}

.icon-plus {
    color: #ef4444;
    font-size: 20px;
    font-weight: bold;
}

/* 移除旧的按钮样式 - 但保留类名以防其他地方使用 */
.button {
    display: none;
}

/* 确保控制图标显示正确 */
.control-icon {
    display: flex !important;
}

#node-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    pointer-events: auto;
    max-width: 300px;
    display: none;
}

#node-info h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #60a5fa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.info-row {
    display: flex;
    margin-bottom: 5px;
}

.info-label {
    font-size: 11px;
    color: #94a3b8;
    min-width: 80px;
}

.info-value {
    font-size: 12px;
    color: #f8fafc;
    flex: 1;
    word-break: break-word;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.8);
    pointer-events: none;
    z-index: 5;
    animation: ripple-animation 1s ease-out forwards;
}

@keyframes ripple-animation {
    0% {
        transform: scale(0.1);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.highlight-node {
    animation: node-highlight 2s ease-in-out;
}

@keyframes node-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(96, 165, 250, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0);
    }
}

/* 罗盘定穴样式 */
.compass-hidden {
    display: none !important;
}

#compass-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 20;
    width: auto;
    max-width: 90vw;
}

.compass-container {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(96, 165, 250, 0.5);
    border-radius: 16px;
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
}

.compass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
    cursor: move;
    user-select: none;
}

.compass-title {
    font-size: 16px;
    color: #60a5fa;
    font-weight: bold;
    letter-spacing: 1px;
}

.compass-close {
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.compass-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.compass-direction {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(96, 165, 250, 0.3);
}

.compass-north,
.compass-east,
.compass-south,
.compass-west {
    position: absolute;
    font-size: 16px;
    color: #f8fafc;
    font-weight: bold;
}

.compass-north {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #ef4444;
}

.compass-east {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.compass-south {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-west {
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 80px;
    background: #ef4444;
    transform-origin: 50% 0;
    transform: translate(-50%, -100%) rotate(0deg);
    transition: transform 0.5s ease;
    border-radius: 2px;
}

.compass-needle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #ef4444;
}

.compass-coordinates {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.coord-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.coord-value {
    font-size: 14px;
    color: #f8fafc;
    font-family: 'Monaco', monospace;
    margin-bottom: 10px;
    word-break: break-all;
}

.compass-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.button.small {
    padding: 6px 12px;
    font-size: 11px;
    flex: 1;
}

/* 节点信息显示 */
#node-info.active {
    display: block;
}

/* 右上角搜索面板样式 - 可折叠 */
#search-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 搜索图标按钮 - 默认显示 */
.search-toggle {
    width: 48px;
    height: 48px;
    /* background: rgba(0, 0, 0, 0.7); */
    backdrop-filter: blur(10px);
    /* border: 1px solid rgba(255, 255, 255, 0.1);  */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #60a5fa;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    opacity: 0.85;
}

.search-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(96, 165, 250, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.search-toggle:active {
    transform: scale(0.95);
}

/* 搜索表单容器 - 默认隐藏 */
.search-form-container {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 350px;
    max-width: 90vw;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.search-form-container.expanded {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 搜索表单标题 */
.search-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
}

.search-form-title {
    font-size: 14px;
    color: #60a5fa;
    font-weight: bold;
    letter-spacing: 1px;
}

.search-form-close {
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-form-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* 搜索输入组 */
.search-input-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    height: 40px;
    margin-bottom: 10px;
}

.search-input-group:focus-within {
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 2px 12px rgba(96, 165, 250, 0.3);
    background: rgba(0, 0, 0, 0.4);
}

.search-input {
    flex: 1;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    color: #e2e8f0;
    font-size: 13px;
    padding: 8px 12px;
    outline: none !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    height: 100%;
    backdrop-filter: blur(0);
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* 强制消除所有状态下的背景和边框影响 */
.search-input,
.search-input:focus,
.search-input:active,
.search-input:hover,
.search-input:not(:placeholder-shown),
.search-input:valid,
.search-input:invalid,
.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover, 
.search-input:-webkit-autofill:focus {
    background-color: transparent !important;
    background: transparent !important;
    -webkit-box-shadow: 0 0 0px 1000px transparent inset !important; /* 消除自动填充的底色 */
    transition: background-color 5000s ease-in-out 0s; /* 减缓自动填充颜色的出现 */
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: #e2e8f0 !important; /* 默认文字颜色 */
}

/* 焦点和有值状态文字颜色 */
.search-input:focus,
.search-input:not(:placeholder-shown) {
    color: #ffffff !important;
}

/* 自动填充状态文字颜色 */
.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover, 
.search-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e2e8f0 !important; /* Webkit自动填充文字颜色 */
    color: #e2e8f0 !important;
}

.search-input::placeholder {
    color: #94a3b8;
    font-size: 12px;
    opacity: 0.7;
}

/* 隐藏 Chrome 等浏览器搜索框默认的清除和装饰 */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
    display: none;
}

.search-select {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 12px;
    padding: 0 8px;
    margin: 0 4px;
    outline: none;
    cursor: pointer;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 4px center;
    background-repeat: no-repeat;
    background-size: 0.9em;
    padding-right: 20px;
    height: 100%;
    border-radius: 0;
}

.search-select:focus {
    color: #ffffff;
    background: transparent;
    box-shadow: none;
}

.search-select option {
    background-color: #1e293b;
    color: #cbd5e1;
}

.search-submit-button {
    background: rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: bold;
    width: 100%;
    margin-top: 5px;
}

.search-submit-button:hover {
    background: rgba(96, 165, 250, 0.3);
    border-color: rgba(96, 165, 250, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.2);
}

.search-submit-button:active {
    transform: translateY(0);
}

/* 搜索结果区域样式 */
.search-results {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid rgba(96, 165, 250, 0.2);
    padding-top: 10px;
}

.search-empty {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
}

.empty-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-text {
    font-size: 12px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-item {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(96, 165, 250, 0.1);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(96, 165, 250, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.result-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.result-tag.贞 {
    background: rgba(245, 158, 11, 0.2);
    color: #724a04;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.result-tag.又贞 {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-tag.对贞 {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.result-node-id {
    font-size: 13px;
    color: #f8fafc;
    font-weight: bold;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-serial-id {
    font-size: 10px;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
}

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.result-relevance,
.result-weight {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    white-space: nowrap;
}

.relevance-label,
.weight-label {
    color: #94a3b8;
    white-space: nowrap;
}

.relevance-value {
    color: #10b981;
    font-weight: bold;
}

.weight-value {
    color: #f59e0b;
    font-weight: bold;
}

.result-content {
    margin-bottom: 10px;
}

.result-event-tuple {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-tags {
    display: flex;
    gap: 6px;
}

.tag-block {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.result-actions {
    display: flex;
    justify-content: flex-end;
}

.result-action-btn {
    background: rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    font-size: 11px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: bold;
}

.result-action-btn:hover {
    background: rgba(96, 165, 250, 0.3);
    border-color: rgba(96, 165, 250, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.2);
}

.result-action-btn:active {
    transform: translateY(0);
}

/* 3D-force-graph tooltip 样式 - 极简版 */
.force-graph-tooltip {
    background: rgba(54, 53, 53, 0.74) !important; /* 纯黑背景，高不透明度 */
    color: #eee9e9 !important; /* 纯白文字，最高对比度 */
    border: none !important; /* 移除边框 */
    border-radius: 0 !important; /* 移除圆角 */
    padding: 16px !important; /* 增加内边距 */
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 12px !important; /* 增大字号（原12px -> 14px，增大两号） */
    box-shadow: none !important; /* 移除阴影 */
    max-width: 500px !important; /* 增加最大宽度 */
    min-width: 300px !important; /* 增加最小宽度 */
    word-wrap: break-word !important;
    white-space: normal !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    transform: translateY(-100%) translateX(-50%) !important;
    position: absolute !important;
    top: -40px !important; /* 离节点更近一些 */
    left: 50% !important;
    line-height: 1.6 !important; /* 增加行高 */
    backdrop-filter: none !important; /* 移除模糊效果 */
    border-radius: 8px !important; /* 轻微圆角 */
    /* 不透明度 */
    opacity: 1 !important;
}

/* 简化尖角 - 纯黑色 */
.force-graph-tooltip::before {
    content: '';
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-width: 8px !important; /* 增加尖角大小 */
    border-style: solid !important;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent !important; /* 纯黑色尖角 */

}

/* tooltip标题样式 - 极简 */
.force-graph-tooltip .tooltip-title {
    color: #6f6b91 !important; /* 纯白色 */
    font-weight: bold !important; /* 加粗 */
    margin-bottom: 14px !important; /* 增加边距 */
    font-size: 14px !important; /* 增大字号（原13px -> 16px） */
    padding-bottom: 0 !important; /* 移除内边距 */
    border-bottom: none !important; /* 移除边框 */
}

/* 简化tooltip内容区域 */
.force-graph-tooltip .tooltip-simple {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important; /* 行间距 */
}

/* 简化行样式 */
.force-graph-tooltip .tooltip-row {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important; /* 元素间距 */
    font-size: 12px !important; /* 增大字号 */
    line-height: 1.4 !important; /* 增加行高 */
}

/* 简化标签样式 */
.force-graph-tooltip .tooltip-label {
    color: #9e9a9a !important; /* 浅灰色标签 */
    font-size: 12px !important; /* 增大字号 */
    font-weight: normal !important; /* 正常粗细 */
    min-width: 40px !important; /* 固定标签宽度 */
}

/* 简化值样式 */
.force-graph-tooltip .tooltip-value {
    color: #a8a5a5 !important; /* 纯白色值 */
    font-size: 14px !important; /* 增大字号 */
    font-weight: normal !important; /* 正常粗细 */
}

/* 权重值特殊样式 - 简化 */
.force-graph-tooltip .tooltip-value.weight-value {
    color: #ffcc00 !important; /* 亮黄色，突出权重 */
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 14px !important; /* 增大字号 */
    font-weight: bold !important; /* 加粗 */
}

/* 状态样式 */
.force-graph-tooltip .tooltip-status {
    color: #aaaaaa !important; /* 灰色状态 */
    font-size: 13px !important; /* 稍小字号 */
    font-style: italic !important; /* 斜体 */
}

/* 事件内容样式 - 简化 */
.force-graph-tooltip .tooltip-event-content {
    color: #ffffff !important; /* 纯白色 */
    font-size: 12px !important; /* 增大字号 */
    line-height: 1.4 !important; /* 增加行高 */
    background: none !important; /* 移除背景 */
    padding: 0 !important; /* 移除内边距 */
    border-radius: 0 !important; /* 移除圆角 */
    border: none !important; /* 移除边框 */
    max-height: none !important;
    overflow-y: visible !important;
    flex: 1 !important; /* 占据剩余空间 */
}

/* EasyMDE编辑器样式覆盖 - 确保在深色主题下可见 */
.EasyMDEContainer {
    width: 100% !important;
    background: #111827 !important; /* 深色背景 */
    border-radius: 8px !important;
    overflow: hidden !important;
}

.editor-toolbar {
    opacity: 1 !important;
    border: 1px solid #374151 !important;
    background-color: #1f2937 !important;
    border-radius: 8px 8px 0 0 !important;
}

.editor-toolbar button {
    color: #9ca3af !important;
    border: none !important;
    background: transparent !important;
}

.editor-toolbar button:hover {
    color: #60a5fa !important;
    background: #374151 !important;
}

.CodeMirror {
    border: 1px solid #374151 !important;
    background: #0f172a !important;
    color: #e5e7eb !important;
    height: 450px !important; /* 强制给个高度防止空白 */
    border-radius: 0 0 8px 8px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 14px !important;
}

.CodeMirror-cursor {
    border-left: 2px solid #60a5fa !important;
}

.editor-statusbar {
    background: #1f2937 !important;
    border-top: 1px solid #374151 !important;
    color: #9ca3af !important;
}

.editor-preview {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

.editor-preview-side {
    background: #0f172a !important;
    color: #e5e7eb !important;
    border-left: 1px solid #374151 !important;
}

/* 确保模态框内容区域有足够高度 */
#event-tuple-modal .flex-1 {
    min-height: 500px !important;
}

#modal-event-tuple-editor {
    min-height: 450px !important;
}

/* 修复模态框按钮图标显示 - 只针对SVG图标 */
#event-tuple-modal #copy-event-tuple-btn svg,
#event-tuple-modal #close-event-tuple-modal-btn svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    stroke: currentColor !important; /* 使用当前颜色作为描边 */
    fill: none !important; /* 确保没有填充色 */
}

#event-tuple-modal #copy-event-tuple-btn svg {
    color: #9ca3af !important;
}

#event-tuple-modal #copy-event-tuple-btn:hover svg {
    color: #10b981 !important; /* 绿色 */
}

#event-tuple-modal #close-event-tuple-modal-btn svg {
    color: #9ca3af !important;
}

#event-tuple-modal #close-event-tuple-modal-btn:hover svg {
    color: #ef4444 !important; /* 红色 */
}

/* 修复EasyMDE工具栏布局 - 恢复原始布局 */
.editor-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
}

.editor-toolbar button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
}

/* 事件叙述放大模态框样式 */
.event-tuple-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
}

.event-tuple-modal.hidden {
    display: none !important;
}

.event-tuple-modal-content {
    background-color: #111827 !important;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    width: 90% !important;
    max-width: 64rem !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    z-index: 50 !important;
}

.event-tuple-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1rem !important;
    border-bottom: 1px solid #374151 !important;
}

.event-tuple-modal-header h3 {
    font-size: 1.125rem !important;
    font-weight: bold !important;
    color: #60a5fa !important;
    margin: 0 !important;
}

.event-tuple-modal-buttons {
    display: flex !important;
    gap: 0.5rem !important;
}

.event-tuple-modal-button {
    width: 2rem !important;
    height: 2rem !important;
    background-color: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 0.375rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #9ca3af !important;
    transition: all 0.3s !important;
    cursor: pointer !important;
    padding: 0 !important;
}

.event-tuple-modal-button:hover {
    border-color: currentColor !important;
}

.event-tuple-modal-button.copy-button:hover {
    color: #10b981 !important;
    border-color: #10b981 !important;
}

.event-tuple-modal-button.close-button:hover {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

.event-tuple-modal-icon {
    width: 1rem !important;
    height: 1rem !important;
    stroke: currentColor !important;
    fill: none !important;
}

.event-tuple-modal-body {
    flex: 1 !important;
    padding: 1rem !important;
    overflow: hidden !important;
}

.event-tuple-editor-textarea {
    width: 100% !important;
    height: 100% !important;
    min-height: 450px !important;
}

.event-tuple-modal-footer {
    padding: 0.75rem !important;
    border-top: 1px solid #374151 !important;
    font-size: 0.75rem !important;
    color: #6b7280 !important;
    text-align: center !important;
}

/* 移动端适配 - 编辑器模态框 */
@media (max-width: 768px) {
    .event-tuple-modal-content {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 95vh !important;
        border-radius: 12px !important;
    }
    
    .event-tuple-modal-header {
        padding: 0.75rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    .event-tuple-modal-header h3 {
        font-size: 1rem !important;
    }
    
    .event-tuple-modal-buttons {
        align-self: flex-end !important;
    }
    
    .event-tuple-modal-body {
        padding: 0.75rem !important;
        min-height: 300px !important;
    }
    
    .event-tuple-editor-textarea {
        min-height: 300px !important;
    }
    
    /* 调整EasyMDE工具栏以适应移动端 */
    .editor-toolbar {
        flex-wrap: wrap !important;
        padding: 4px !important;
    }
    
    .editor-toolbar button {
        width: 32px !important;
        height: 32px !important;
        margin: 2px !important;
    }
    
    .CodeMirror {
        height: 350px !important;
        font-size: 14px !important;
    }
    
    .event-tuple-modal-footer {
        padding: 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    /* 增大移动端放大图标的点击区域 */
    #expand-event-tuple-btn {
        width: 32px !important;
        height: 32px !important;
        bottom: 8px !important;
        right: 8px !important;
    }
    
    #expand-event-tuple-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* 模态框头部的关闭和复制按钮也相应放大 */
    .event-tuple-modal-button {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    .event-tuple-modal-icon {
        width: 1.125rem !important;
        height: 1.125rem !important;
    }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
    .event-tuple-modal-content {
        width: 98% !important;
        max-width: 98% !important;
        max-height: 98vh !important;
    }
    
    .event-tuple-modal-header {
        padding: 0.5rem !important;
    }
    
    .event-tuple-modal-header h3 {
        font-size: 0.9rem !important;
    }
    
    .event-tuple-modal-button {
        width: 2.25rem !important;
        height: 2.25rem !important;
    }
    
    .event-tuple-modal-icon {
        width: 1rem !important;
        height: 1rem !important;
    }
    
    .event-tuple-modal-body {
        padding: 0.5rem !important;
        min-height: 250px !important;
    }
    
    .event-tuple-editor-textarea {
        min-height: 250px !important;
    }
    
    .CodeMirror {
        height: 300px !important;
        font-size: 13px !important;
    }
    
    /* 调整EasyMDE工具栏按钮大小 */
    .editor-toolbar button {
        width: 28px !important;
        height: 28px !important;
        margin: 1px !important;
    }
    
    .editor-toolbar button i {
        font-size: 12px !important;
    }
}

/* 移动端适配 - 控制按钮组 */
@media (max-width: 768px) {
    #controls {
        bottom: 15px;
        left: 15px;
        gap: 8px;
    }

    #telescope-panel {
        left: 30px; /* 移动端向左偏移 10px */
    }
    
    .control-icon {
        width: 56px;
        height: 56px;
    }
    
    .icon-zoom,
    .icon-compass,
    .icon-plus {
        font-size: 24px;
    }
    
    .control-icon::after {
        font-size: 12px;
        padding: 8px 12px;
        bottom: calc(100% + 5px);
    }
}

/* 超小屏幕手机适配 */
/* 移动端 header 折叠按钮 */
#header-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* 显示折叠按钮 */
    #header-toggle {
        display: flex;
        position: fixed;
        top: 8px;
        left: 8px;
        z-index: 9999;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.45);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: #60a5fa;
        font-size: 22px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        user-select: none;
        transition: background 0.2s;
        pointer-events: auto !important;
        opacity: 0.7;
    }
    #header-toggle:active {
        background: rgba(0, 0, 0, 0.7);
    }

    /* 移动端 header 默认隐藏（向上滑出屏幕） */
    #header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 80px;
        z-index: 10000 !important;
        padding: 10px 16px 10px 52px;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(10px);
        border-radius: 0 0 12px 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        transform: translateY(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    #header.expanded {
        transform: translateY(0);
    }
    #header h1 {
        font-size: 14px;
    }
    #header .subtitle {
        font-size: 10px;
        margin-top: 2px;
    }
}

@media (max-width: 480px) {
    #controls {
        bottom: 10px;
        left: 10px;
        gap: 6px;
    }
    
    .control-icon {
        width: 52px;
        height: 52px;
    }
    
    .icon-zoom,
    .icon-compass,
    .icon-plus {
        font-size: 22px;
    }
}

/* ========== Header HUD ========== */
#header .header-hud {
    margin-top: 6px;
    display: none;
}
#header .header-hud.active {
    display: block;
}
#header .header-hud-row {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(160, 168, 180, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#header .header-hud-row .hud-sep {
    margin: 0 8px;
    color: rgba(120, 130, 145, 0.30);
}
#header .header-hud-row #hud-serial,
#header .header-hud-row #hud-weight {
    color: #00d4ff;
    font-weight: bold;
}

#header .header-hud-row #hud-serial .hud-s-val,
#header .header-hud-row #hud-weight .hud-w-val {
    color: #10b981;
    letter-spacing: 0;
}

#header .header-hud-row .hud-w-stat {
    color: rgba(245, 236, 200, 0.75);
    /* font-style: italic; */
    font-size: 13px;
}
#header .header-hud-event {
    font-size: 12px;
    line-height: 1.5;
    color: rgb(159 164 171 / 85%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    margin-top: 2px;
}

@media (max-width: 768px) {
    #header .header-hud-event {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}
