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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    color: #2c3e50;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.controls button {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.controls button:hover:not(:disabled) {
    background: #2980b9;
}

.controls button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.api-key-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 200px;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 1.5rem;
    overflow-y: auto;
}

.stats h3,
.node-list h3 {
    margin-top: 1rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item .label {
    color: #7f8c8d;
}

.stat-item .value {
    font-weight: bold;
}

.stat-item .value.online {
    color: #27ae60;
}

.stat-item .value.offline {
    color: #e74c3c;
}

.stat-item .value.unknown {
    color: #f39c12;
}

.node-detail {
    margin-top: 1rem;
}

.node-detail p {
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}

.status-badge.online {
    background: #d5f4e6;
    color: #27ae60;
}

.status-badge.offline {
    background: #fadbd8;
    color: #e74c3c;
}

.status-badge.unknown {
    background: #fef5e7;
    color: #f39c12;
}

.peer-list {
    list-style: none;
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.peer-list li {
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.latency {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.routes-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.route-list {
    list-style: none;
    margin-top: 0.5rem;
    padding: 0;
}

.route-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.route-dst {
    font-weight: bold;
    color: #2c3e50;
    font-size: 0.9rem;
}

.route-status {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
}

.route-status.success {
    background: #d5f4e6;
    color: #27ae60;
}

.route-status.failed {
    background: #fadbd8;
    color: #e74c3c;
}

.route-path {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #34495e;
    background: #fff;
    padding: 0.5rem;
    border-radius: 3px;
    margin: 0.5rem 0;
    word-break: break-all;
}

.route-path.no-path {
    color: #95a5a6;
    font-style: italic;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

.route-hops,
.route-latency,
.route-time {
    display: inline-block;
}

.link-list {
    margin-top: 1rem;
}

.link-detail {
    margin-top: 1rem;
}

.link-direction {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.link-direction:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.direction-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.link-info p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.state-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    background: #ecf0f1;
    color: #2c3e50;
}

.no-data {
    color: #95a5a6;
    font-style: italic;
    font-size: 0.85rem;
}

.topology-container {
    flex: 1;
    position: relative;
    background: #fff;
}

.topology-graph {
    width: 100%;
    height: 100%;
}

.loading,
.error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.error {
    color: #e74c3c;
    background: #fadbd8;
}

/* Cytoscape 样式 */
#cy {
    background: #fafafa;
}

