/* Polymarket Network - Original Design (from trading_graph.html) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

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

body {
    background: #f5ebe0;
    color: #5c5048;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    overflow: hidden;
}

/* GPU-accelerated filtering for instant response */
.cy-node, .cy-edge {
    will-change: transform, opacity;
}

.cy-node.filtered-instant {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8);
    transition: opacity 0.1s ease-out, transform 0.1s ease-out;
}

.cy-node.virtualized {
    display: none !important;
}

.cy-node.preloaded {
    opacity: 0;
    pointer-events: none;
}

.header {
    background: #ede4d4;
    padding: 8px 16px;
    border-bottom: 1px solid #d4c4b0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title { 
    font-size: 12px; 
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.stats { display: flex; gap: 20px; font-size: 10px; align-items: center; }
.stat-item { display: flex; gap: 4px; align-items: center; }
.stat-label { color: #7a8478; }
.stat-value { color: #5c5048; font-weight: 500; }

/* Header Buttons - unified style */
.physics-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.header-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.header-btn.search-btn {
    background: #dbbc7f;
}

.header-btn.physics-btn,
.header-btn.adventure-btn {
    background: #7fbbb3;
}

/* Wallet Container */
.wallet-container {
    position: relative;
}

.wallet-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.wallet-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.wallet-btn.connected {
    background: linear-gradient(135deg, #10b981, #059669);
}

.wallet-btn.connected:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.wallet-btn .wallet-icon {
    font-size: 11px;
}

.wallet-btn .wallet-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}

.wallet-btn .wallet-address {
    font-family: monospace;
    font-size: 9px;
    letter-spacing: 0.5px;
}

/* Wallet Dropdown */
.wallet-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #d4c4b0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.wallet-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wallet-dropdown-header {
    padding: 10px 12px;
    border-bottom: 1px solid #e8e0d4;
    background: #f9f6f2;
}

.wallet-dropdown-label {
    display: block;
    font-size: 9px;
    color: #7a8478;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wallet-dropdown-address {
    display: block;
    font-family: monospace;
    font-size: 11px;
    color: #5c5048;
    word-break: break-all;
}

.wallet-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    color: #5c5048;
    cursor: pointer;
    transition: background 0.15s;
}

.wallet-dropdown-btn:hover {
    background: #f5f0e8;
}

.wallet-dropdown-btn.disconnect-btn {
    color: #e67e80;
}

.wallet-dropdown-btn.disconnect-btn:hover {
    background: #fef2f2;
}

/* Proxy Wallet Section */
.proxy-wallet-section {
    padding: 10px 12px;
    border-bottom: 1px solid #e8e0d4;
    background: #f0fdf4;
}

.proxy-wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.proxy-label {
    font-size: 9px;
    color: #059669;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.proxy-address {
    font-family: monospace;
    font-size: 10px;
    color: #047857;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.proxy-address:hover {
    color: #059669;
}

.proxy-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.proxy-balance-label {
    font-size: 10px;
    color: #7a8478;
}

.proxy-balance-value {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
}

/* Approval Status Section in Wallet Dropdown */
.approval-status-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #d1fae5;
}

.approval-status {
    font-size: 10px;
    margin-bottom: 6px;
}

.approval-checking {
    color: #7a8478;
}

.approval-ok {
    color: #059669;
}

.approval-needed {
    color: #d97706;
}

.approval-partial {
    color: #2563eb;
}

.wallet-approve-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.wallet-approve-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.wallet-approve-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* No Proxy Section */
.no-proxy-section {
    padding: 10px 12px;
    border-bottom: 1px solid #e8e0d4;
    background: #fefce8;
    text-align: center;
}

.no-proxy-text {
    font-size: 11px;
    color: #a16207;
    margin-bottom: 8px;
}

.create-proxy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.create-proxy-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    text-decoration: none;
}

.no-proxy-hint {
    font-size: 9px;
    color: #92400e;
    margin-top: 6px;
    opacity: 0.8;
}

/* Connection Status - bottom left */
.status {
    position: fixed;
    bottom: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    text-transform: uppercase;
    background: #ede4d4;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d4c4b0;
    z-index: 100;
    cursor: default;
}
.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.status.connected { color: #a7c080; }
.status.connected::before { background: #a7c080; }
.status.disconnected { color: #e67e80; }
.status.disconnected::before { background: #e67e80; }

/* Data Update Banner */
.update-banner {
    position: fixed;
    bottom: 40px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #3a4248;
    color: #d3c6aa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #a7c080;
    font-size: 12px;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: bannerSlideIn 0.3s ease-out;
}
@keyframes bannerSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.update-banner-icon {
    font-size: 14px;
}
.update-banner-text {
    flex: 1;
    white-space: nowrap;
}
.update-banner-btn {
    background: #a7c080;
    color: #2d353b;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
}
.update-banner-btn:hover {
    background: #b8d090;
}
.update-banner-close {
    background: none;
    border: none;
    color: #859289;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.update-banner-close:hover {
    color: #d3c6aa;
}

#cy {
    width: 100%;
    height: calc(100vh - 37px);
    cursor: default;
}

#cy:active {
    cursor: grabbing;
}

/* Filters Panel */
.filters-panel {
    position: absolute;
    top: 50px;
    left: 12px;
    background: #ede4d4;
    border: 1px solid #d4c4b0;
    border-radius: 6px;
    width: 280px;
    font-size: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Disabled state for exploration mode */
.filters-panel.disabled {
    opacity: 0.5;
}

.filters-panel.disabled .filters-content {
    pointer-events: none;
    filter: grayscale(0.5);
}

.filters-panel.disabled .filters-header {
    cursor: not-allowed;
}

.filters-panel.disabled input,
.filters-panel.disabled select,
.filters-panel.disabled button {
    pointer-events: none;
    cursor: not-allowed;
}

.filters-panel.collapsed {
    width: 24px;
}

.filters-panel.collapsed .filters-content {
    display: none;
}

.filters-panel.collapsed .filters-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 12px 6px;
    justify-content: center;
    gap: 8px;
}

.filters-panel.collapsed .filters-header span:first-child {
    display: block;
}

.filters-panel.collapsed .toggle-icon {
    transform: rotate(90deg);
}

.filters-header {
    background: #e5dcc8;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.filters-header:hover {
    background: #ddd3be;
}

.filters-header span {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 8px;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.filters-panel.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.filters-content {
    padding: 10px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d4c4b0;
}

.filter-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.section-title {
    font-size: 9px;
    font-weight: 500;
    color: #7a8478;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.filter-tab {
    flex: 1 1 auto;
    min-width: 60px;
    padding: 5px 6px;
    border: 1px solid #d4c4b0;
    background: #f5ebe0;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    color: #5c5048;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.filter-tab:hover {
    background: #e5dcc8;
}

.filter-tab.active {
    background: #7a8478;
    color: #fff;
    border-color: #7a8478;
}

/* Filter tab content visibility */
.filter-tab-content {
    display: none;
}

.filter-tab-content.active {
    display: block;
}

/* Tab content styling */
.filter-tab-content .section-title {
    font-size: 9px;
    font-weight: 500;
    color: #7a8478;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Sort group in Simple tab */
.sort-group {
    gap: 2px;
}

.sort-group .btn {
    flex: 1;
    padding: 3px 4px;
    font-size: 8px;
}

.btn.small {
    padding: 3px 4px;
    font-size: 8px;
}

.filter-row {
    margin-bottom: 4px;
}

.filter-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1px;
    color: #7a8478;
}

.filter-value {
    color: #5c5048;
    font-weight: 500;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #b8c5d0;
    border-radius: 2px;
    outline: none;
}

/* Range slider with two thumbs - single track */
.range-slider {
    position: relative;
    height: 28px;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 3;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #7a8478;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    position: relative;
    margin-top: -4px;
    z-index: 4;
}

.range-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: #5c5048;
}

.range-slider-track {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 0;
    background: #e67e80;
    border-radius: 2px;
    z-index: 1;
}

.range-slider-fill {
    position: absolute;
    height: 4px;
    top: 0;
    left: 0;
    width: 100%;
    background: #a7c080;
    border-radius: 2px;
    z-index: 2;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    pointer-events: none;
}

.range-values span {
    font-size: 9px;
    color: #7a8478;
    white-space: nowrap;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #7a8478;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #5c5048;
}

.btn-group {
    display: flex;
    gap: 4px;
}

.btn-group.tags-group {
    flex-wrap: wrap;
}

.btn.tag-btn {
    flex: 0 0 auto;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 12px;
    position: relative;
}

.btn.tag-btn.active {
    background: var(--tag-color, #7a8478);
    border-color: var(--tag-color, #7a8478);
}

.btn {
    flex: 1;
    padding: 5px 6px;
    border: 1px solid #d4c4b0;
    background: #f5ebe0;
    border-radius: 3px;
    font-size: 9px;
    cursor: pointer;
    font-family: inherit;
    color: #5c5048;
    transition: all 0.2s;
}

.btn:hover {
    background: #e5dcc8;
}

.btn.active {
    background: #7a8478;
    color: #fff;
    border-color: #7a8478;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 0 0 0;
    border-top: 1px solid #d4c4b0;
}

.filter-buttons .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apply-btn {
    background: #7fbbb3 !important;
    color: #fff !important;
    border-color: #7fbbb3 !important;
}

.apply-btn:hover:not(:disabled) {
    background: #6aa89f !important;
}

.apply-btn:disabled {
    background: #c5d5d1 !important;
    border-color: #c5d5d1 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.reset-btn {
    background: #f5f0e8 !important;
    border-color: #d4c4b0 !important;
    color: #5c5048 !important;
}

.reset-btn:hover:not(:disabled) {
    background: #e8e0d4 !important;
}

.reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Node Panel */
.node-panel {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: #ede4d4;
    border: 1px solid #d4c4b0;
    border-radius: 6px;
    padding: 12px;
    width: 280px;
    display: none;
}

.node-panel.visible { display: block; }

/* Timeframe buttons */
.timeframe-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d4c4b0;
}

.tf-btn {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #d4c4b0;
    border-radius: 4px;
    background: transparent;
    color: #5c5048;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tf-btn:hover {
    background: #f5ebe0;
}

.tf-btn.active {
    background: #7fbbb3;
    color: #2d353b;
    border-color: #7fbbb3;
}

.node-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.node-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5a84b;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 10px;
}

.node-title { font-weight: 500; }
.node-subtitle { font-size: 9px; color: #7a8478; }

.node-address {
    font-size: 8px;
    color: #7fbbb3;
    background: #f5ebe0;
    padding: 6px 8px;
    border-radius: 3px;
    margin: 8px 0;
    word-break: break-all;
    cursor: pointer;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.info-label { color: #7a8478; }
.info-value { color: #5c5048; font-weight: 500; }

/* Leaderboard Panel */
.leaderboard-panel {
    position: absolute;
    top: 50px;
    right: 12px;
    background: #ede4d4;
    border: 1px solid #d4c4b0;
    border-radius: 6px;
    width: 260px;
    font-size: 10px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.leaderboard-panel.collapsed {
    width: 24px;
}

.leaderboard-panel.collapsed .leaderboard-body {
    display: none;
}

.leaderboard-panel.collapsed .leaderboard-toggle {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 12px 6px;
    justify-content: center;
    gap: 8px;
}

.leaderboard-panel.collapsed .leaderboard-toggle span:first-child {
    display: block;
}

.leaderboard-panel.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.leaderboard-toggle {
    background: #e5dcc8;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.leaderboard-toggle:hover {
    background: #ddd3be;
}

.leaderboard-toggle span {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 8px;
    color: #5c5048;
}

.leaderboard-toggle .toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.leaderboard-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.leaderboard-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f5ebe0;
    border-bottom: 1px solid #d4c4b0;
}

.tab-btn {
    flex: 1;
    padding: 5px 6px;
    border: 1px solid #d4c4b0;
    background: #f5ebe0;
    border-radius: 3px;
    font-size: 9px;
    cursor: pointer;
    font-family: inherit;
    color: #5c5048;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #e5dcc8;
}

.tab-btn.active {
    background: #7a8478;
    color: #fff;
    border-color: #7a8478;
}

.leaderboard-content {
    padding: 8px;
    overflow-y: auto;
    max-height: 300px; /* ~5 items visible */
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 4px;
    background: #f5ebe0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: #e5dcc8;
}

.leaderboard-item.skeleton {
    height: 44px;
    background: linear-gradient(90deg, #f5ebe0 25%, #e5dcc8 50%, #f5ebe0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.leaderboard-rank {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d4c4b0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 9px;
    color: #5c5048;
    margin-right: 8px;
    flex-shrink: 0;
}

.leaderboard-rank.gold { background: #e5a84b; color: #fff; }
.leaderboard-rank.silver { background: #a8a8a8; color: #fff; }
.leaderboard-rank.bronze { background: #cd7f32; color: #fff; }

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-weight: 500;
    color: #5c5048;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 9px;
}

.leaderboard-stats {
    display: flex;
    gap: 8px;
    font-size: 8px;
    color: #7a8478;
    margin-top: 2px;
}

.leaderboard-stats .value {
    color: #5c5048;
    font-weight: 500;
}

.leaderboard-volume {
    text-align: right;
    flex-shrink: 0;
    margin-left: 8px;
}

.leaderboard-volume .amount {
    font-weight: 600;
    color: #5c5048;
    font-size: 10px;
}

.leaderboard-volume .label {
    font-size: 7px;
    color: #7a8478;
    text-transform: uppercase;
}

/* Leaderboard Buy/Sell buttons for tokens */
.leaderboard-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.lb-trade-btn {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lb-trade-btn.buy {
    background: #a7c080;
    color: #2d353b;
}

.lb-trade-btn.buy:hover {
    background: #8fb573;
}

.lb-trade-btn.sell {
    background: #e67e80;
    color: #2d353b;
}

.lb-trade-btn.sell:hover {
    background: #d4686a;
}

/* Minimap */
#minimap-container {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 150px;
    height: 150px;
    background: #f5f0e8;
    border: 1px solid #d4c4b0;
    border-radius: 6px;
    overflow: hidden;
    z-index: 100;
}

#minimap {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#minimap-viewport {
    position: absolute;
    border: 2px solid #7fbbb3;
    background: rgba(127, 187, 179, 0.2);
    pointer-events: none;
}

/* Performance: GPU-accelerated hiding for faster toggle */
.fast-hidden {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Optimized transitions for exploration mode */
.node, .edge {
    will-change: opacity, visibility;
}

.hidden-explore {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: none !important; /* Instant hide for performance */
}

/* Remove transitions during exploration for speed */
.exploration-mode .node,
.exploration-mode .edge {
    transition: none !important;
}

/* =============================================================================
   PERFORMANCE OPTIMIZATIONS - LOD SYSTEM
   ============================================================================= */

/* FPS Indicator */
.fps-indicator {
    position: fixed;
    top: 50px;
    right: 12px;
    background: rgba(45, 53, 59, 0.85);
    color: #a7c080;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    z-index: 1000;
    border: 1px solid rgba(167, 192, 128, 0.3);
}

.fps-indicator.warning {
    color: #e5a84b;
    border-color: rgba(229, 168, 75, 0.3);
}

.fps-indicator.critical {
    color: #e67e80;
    border-color: rgba(230, 126, 128, 0.3);
    animation: fps-pulse 1s infinite;
}

@keyframes fps-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* LOD Classes - hide elements at low zoom */
.lod-hidden {
    display: none !important;
}

/* Cytoscape-specific classes (no-label, simplified, cluster-node) 
   are defined in JavaScript, not CSS */

.clustered {
    display: none !important;
}

/* Cluster button style */
#clusterBtn {
    background: #ede4d4;
    border: 1px solid #d4c4b0;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

#clusterBtn:hover {
    background: #e5dcc8;
}

#clusterBtn.active {
    background: #ff9800;
    color: white;
    border-color: #f57c00;
}

/* ============ Trade Buttons ============ */
.trade-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #d4c4b0;
}

.market-closed-message {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 10px;
    background: #5c5048;
    border-radius: 4px;
    color: #d4c4b0;
    font-size: 12px;
    font-weight: 500;
}

.trade-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: capitalize;
}

.trade-btn.buy-btn {
    background: #a7c080;
    color: #2d353b;
}

.trade-btn.buy-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.trade-btn.sell-btn {
    background: #e67e80;
    color: #2d353b;
}

.trade-btn.sell-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ============ Trade Modal ============ */
.trade-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.trade-modal-content {
    background: #faf6f0;
    border-radius: 10px;
    width: 340px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.trade-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #d4c4b0;
}

.trade-modal-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #5c5048;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #8b7355;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #5c5048;
}

.trade-modal-body {
    padding: 14px 16px;
}

.trade-market-info {
    margin-bottom: 10px;
}

.trade-market-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #5c5048;
    text-decoration: none;
    font-size: 12px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f5f0e8, #ede4d4);
    border-radius: 8px;
    border: 1px solid #d4c4b0;
    transition: all 0.2s;
}

.trade-market-link:hover {
    background: linear-gradient(135deg, #ede4d4, #e5dcc8);
    border-color: #c4b4a0;
}

.trade-market-link #tradeMarketName {
    flex: 1;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.trade-market-link .link-icon {
    color: #8b7355;
    font-size: 14px;
    flex-shrink: 0;
}

.trade-token-info {
    background: #ede4d4;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.trade-token-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #5c5048;
    margin-bottom: 4px;
}

.trade-token-id {
    display: block;
    font-size: 10px;
    color: #8b7355;
    word-break: break-all;
}

.trade-price-info {
    margin-bottom: 16px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.price-label {
    color: #8b7355;
    font-size: 11px;
}

.price-value {
    font-size: 14px;
    font-weight: 600;
    color: #5c5048;
}

.trade-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    color: #8b7355;
    font-weight: 500;
}

.input-with-suffix {
    display: flex;
    align-items: stretch;
    background: white;
    border: 1px solid #d4c4b0;
    border-radius: 8px;
    overflow: hidden;
    gap: 0;
}

.input-with-suffix:focus-within {
    border-color: #7fbbb3;
    box-shadow: 0 0 0 2px rgba(127, 187, 179, 0.15);
}

.input-with-suffix input {
    flex: 1;
    border: none;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    outline: none;
    min-width: 0;
}

.input-with-suffix input:focus {
    background: transparent;
}

.input-suffix {
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: #f5f0e8;
    color: #8b7355;
    font-size: 12px;
    font-weight: 500;
    border-left: 1px solid #d4c4b0;
    white-space: nowrap;
}

/* MAX Button */
.max-btn {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: #7fbbb3;
    color: #2d353b;
    border: none;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin: 0;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 1px solid #d4c4b0;
}

.max-btn:hover {
    background: #6aa99f;
}

.max-btn:active {
    background: #5a9a90;
}

/* Balance display */
.trade-balance {
    background: #e8f5e9;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.trade-balance .balance-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #2e7d32;
    padding: 3px 0;
}

.trade-balance .balance-row span:last-child {
    font-weight: 600;
}

.trade-summary {
    background: #f5f0e8;
    border-radius: 8px;
    padding: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.summary-row .profit {
    color: #4caf50;
    font-weight: 600;
}

.trade-error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    padding: 10px;
    color: #c62828;
    font-size: 11px;
}

.trade-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.trade-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn {
    background: #ede4d4;
    color: #5c5048;
}

.cancel-btn:hover {
    background: #e5dcc8;
}

.approve-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    flex: 1;
    transition: all 0.2s ease;
}

.approve-btn:hover {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    transform: translateY(-1px);
}

.approve-btn:disabled {
    background: #ccc;
    cursor: wait;
}

.confirm-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

.confirm-btn.sell {
    background: linear-gradient(135deg, #f44336, #e53935);
}

.confirm-btn.sell:hover {
    background: linear-gradient(135deg, #e53935, #d32f2f);
}

.confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.trade-status {
    text-align: center;
    padding: 20px;
}

.status-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.status-text {
    font-size: 12px;
    color: #5c5048;
}

.trade-status.success .status-icon {
    color: #4caf50;
}

.trade-status.error .status-icon {
    color: #f44336;
}

/* ============ ORDERBOOK STYLES ============ */

.trade-market-data {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.trade-price-info {
    background: #f5f0e8;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 0;
}

.price-row.main-price {
    border-bottom: 1px solid #e5dcc8;
    padding-bottom: 8px;
    margin-bottom: 6px;
}

.price-row.main-price .price-value {
    font-size: 18px;
    color: #5c5048;
}

.price-row.small {
    padding: 4px 0;
}

.price-row.small .price-label,
.price-row.small .price-value {
    font-size: 10px;
}

.price-value.bid {
    color: #4caf50;
}

.price-value.ask {
    color: #f44336;
}

.orderbook-container {
    background: #1a1e26;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.orderbook-loading {
    color: #8b7355;
    font-size: 11px;
    text-align: center;
    padding: 20px;
}

.orderbook {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.orderbook-asks,
.orderbook-bids {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.orderbook-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 6px;
    position: relative;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.1s;
}

.orderbook-row:hover {
    background: rgba(255, 255, 255, 0.1);
}

.orderbook-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 3px;
    opacity: 0.2;
    transition: width 0.3s ease;
}

.orderbook-row.ask .orderbook-bar {
    background: #f44336;
}

.orderbook-row.bid .orderbook-bar {
    background: #4caf50;
}

.orderbook-price {
    position: relative;
    z-index: 1;
    font-weight: 600;
}

.orderbook-row.ask .orderbook-price {
    color: #ff6b6b;
}

.orderbook-row.bid .orderbook-price {
    color: #69db7c;
}

.orderbook-size {
    position: relative;
    z-index: 1;
    color: #adb5bd;
}

.orderbook-spread {
    text-align: center;
    padding: 6px;
    color: #8b7355;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin: 4px 0;
}

/* Price flash animation */
@keyframes priceFlash {
    0% { background: rgba(255, 255, 0, 0.3); }
    100% { background: transparent; }
}

.price-flash {
    animation: priceFlash 0.3s ease-out;
}

/* ============ ORDER TYPE TOGGLE ============ */

.order-type-toggle {
    display: flex;
    background: #ede4d4;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 14px;
}

.order-type-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #8b7355;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.order-type-btn:hover {
    color: #5c5048;
}

.order-type-btn.active {
    background: white;
    color: #5c5048;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.liquidity-info {
    font-size: 10px;
    color: #8b7355;
    margin-top: 4px;
    padding: 4px 8px;
    background: #f5f0e8;
    border-radius: 4px;
}

.liquidity-info span {
    color: #5c5048;
    font-weight: 600;
}

/* ============ Responsive ============ */

/* Tablets & small laptops */
@media (max-width: 1024px) {
    .stats { gap: 12px; }
    .stat-item { gap: 2px; }
    .leaderboard-panel { width: 220px; }
    .node-panel { width: 260px; }
    .filters-panel { width: 260px; }
}

/* Phones landscape & small tablets */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 10px;
    }
    .title { font-size: 11px; }
    .title img { width: 22px !important; height: 22px !important; }
    .stats {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 8px;
        font-size: 9px;
        border-top: 1px solid #d4c4b0;
        padding-top: 4px;
        margin-top: 2px;
    }
    .physics-controls { gap: 4px; }
    .header-btn { padding: 4px 7px; font-size: 9px; }

    .filters-panel {
        width: 240px;
        left: 8px;
        top: 80px;
    }
    .leaderboard-panel {
        width: 200px;
        right: 8px;
        top: 80px;
        max-height: calc(100vh - 120px);
    }
    .node-panel {
        width: 240px;
        left: 8px;
        bottom: 8px;
    }
    .trade-modal-content {
        width: 320px;
    }
}

/* Phones portrait */
@media (max-width: 480px) {
    .header {
        padding: 5px 8px;
        gap: 4px;
    }
    .title { font-size: 10px; letter-spacing: 0.5px; }
    .title img { width: 20px !important; height: 20px !important; margin-right: 4px !important; }
    .stats { font-size: 8px; gap: 6px; }
    .stat-label { display: none; }
    .physics-controls { gap: 3px; }
    .header-btn {
        padding: 3px 6px;
        font-size: 8px;
    }
    /* Hide less important buttons on very small screens */
    .header-btn.physics-btn { display: none; }
    .wallet-btn span:not(.wallet-icon):not(.wallet-dot) {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filters-panel {
        left: 4px;
        right: 4px;
        width: auto;
        top: auto;
        bottom: 4px;
        max-height: 50vh;
        z-index: 200;
    }
    .leaderboard-panel {
        left: 4px;
        right: 4px;
        width: auto;
        top: auto;
        bottom: 4px;
        max-height: 60vh;
        z-index: 200;
    }
    .leaderboard-panel.collapsed {
        width: auto;
        left: auto;
        right: 4px;
        bottom: 4px;
    }
    .node-panel {
        left: 4px;
        right: 4px;
        width: auto;
        bottom: 4px;
        max-height: 45vh;
        overflow-y: auto;
    }
    .trade-modal-content {
        width: 100vw;
        max-width: 100vw;
        border-radius: 10px 10px 0 0;
        max-height: 85vh;
    }
    .trade-modal {
        align-items: flex-end;
    }

    /* Bulk search */
    .bulk-search-panel {
        width: calc(100vw - 16px) !important;
        left: 8px !important;
        right: 8px !important;
    }
}

/* Large screens */
@media (min-width: 1600px) {
    .header { padding: 10px 24px; }
    .stats { gap: 24px; font-size: 11px; }
    .header-btn { font-size: 11px; padding: 6px 12px; }
    .filters-panel { width: 320px; }
    .leaderboard-panel { width: 300px; }
    .node-panel { width: 320px; }
}

/* Ultra-wide */
@media (min-width: 2400px) {
    .header { padding: 12px 32px; }
    .title { font-size: 14px; }
    .stats { gap: 28px; font-size: 12px; }
    .header-btn { font-size: 12px; padding: 7px 14px; }
    .filters-panel { width: 360px; }
    .leaderboard-panel { width: 340px; }
    .node-panel { width: 360px; }
}
