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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
    letter-spacing: -0.3px;
}

#status {
    background-color: #1677ff;
    color: #ffffff;
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 20px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.2);
    transition: all 0.3s ease;
}

/* ========== ПЕРЕКЛЮЧАТЕЛЬ БИРЖ ========== */
#exchange-switcher {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    background: #ffffff;
    padding: 8px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.exchange-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #8c9cae;
}

.exchange-btn:hover {
    background: #f0f2f5;
    color: #1e293b;
}

.exchange-btn.active {
    background: #1677ff;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
}

.exchange-btn.active:hover {
    background: #0958d9;
}

/* ========== НАСТРОЙКИ КОМИССИЙ ========== */
#fee-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    background: #ffffff;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.settings-label {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
}

.settings-group select {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 13px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-group select:hover {
    border-color: #1677ff;
}

.settings-group select:focus {
    outline: none;
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

.settings-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1677ff;
}

/* ========== ИНФО ========== */
#info-container {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-card {
    background: #ffffff;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.info-label {
    color: #8c9cae;
    font-weight: 500;
}

.info-value {
    color: #1e293b;
    font-weight: 600;
    margin-left: 6px;
}

/* ========== РЕКОМЕНДАЦИИ ========== */
#recommendations-container {
    width: 100%;
    max-width: 800px;
    margin-bottom: 30px;
}

#recommendations {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.recommendation-card.best {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.recommendation-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.triangle-name {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.profit {
    font-size: 22px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
}

.profit-positive {
    color: #52c41a;
    background: rgba(82, 196, 26, 0.1);
}

.profit-negative {
    color: #ff4d4f;
    background: rgba(255, 77, 79, 0.1);
}

.profit-highlight {
    animation: pulse-profit 1s ease-in-out 3;
    font-size: 24px;
}

.profit-usdt {
    font-size: 15px;
    color: #1e293b;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: #f0f7ff;
    border-radius: 8px;
}

.badge-high {
    display: inline-block;
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 20px;
    margin-left: 10px;
    animation: pulse-badge 0.8s ease-in-out infinite alternate;
}

.badge-medium {
    display: inline-block;
    background: #faad14;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 20px;
    margin-left: 10px;
}

@keyframes pulse-badge {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.recommendation-actions {
    margin-bottom: 12px;
}

.action-item {
    font-size: 18px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    background: #f8f9fa;
}

.action-buy {
    border-left: 4px solid #52c41a;
}

.action-sell {
    border-left: 4px solid #ff4d4f;
}

.action-label {
    margin-right: 12px;
}

.action-detail {
    font-weight: 500;
    color: #1e293b;
}

.recommendation-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #f0f2f5;
    margin-top: 10px;
    font-size: 13px;
    color: #5a6a7e;
}

.detail-item {
    background: #f8f9fa;
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.recommendation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f2f5;
}

.fee-info {
    font-size: 13px;
    color: #8c9cae;
}

.recommendation-time {
    font-size: 13px;
    color: #8c9cae;
}

.no-opportunities {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    color: #8c9cae;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ========== ЦЕНЫ ========== */
#prices-container {
    width: 100%;
    max-width: 800px;
}

#prices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.price-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.symbol {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.3px;
}

.price {
    font-size: 14px;
    font-weight: 600;
    color: #04b92e;
    font-variant-numeric: tabular-nums;
}

/* ========== АНИМАЦИИ ========== */
@keyframes pulse-profit {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recommendation-card {
    animation: slideIn 0.3s ease;
}

/* ========== АДАПТИВ ========== */
@media (max-width: 640px) {
    body {
        padding: 20px 12px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 18px;
    }

    .price-item {
        padding: 12px 14px;
    }

    #status {
        font-size: 15px;
        padding: 10px 30px;
    }

    #prices {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .recommendation-card {
        padding: 16px 18px;
    }

    .profit {
        font-size: 18px;
    }

    .triangle-name {
        font-size: 15px;
    }

    .action-item {
        font-size: 15px;
        padding: 8px 12px;
    }

    .detail-item {
        font-size: 12px;
    }

    .recommendation-footer {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }

    #exchange-switcher {
        flex-wrap: wrap;
        justify-content: center;
    }

    .exchange-btn {
        padding: 8px 18px;
        font-size: 14px;
    }

    #fee-settings {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }

    .settings-group {
        justify-content: space-between;
    }

    .settings-group select {
        flex: 1;
        max-width: 200px;
    }
}
/* ========== СТАТИСТИКА ========== */
#statistics-container {
    width: 100%;
    max-width: 800px;
    margin-top: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #8c9cae;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.stat-value.highlight {
    color: #1677ff;
}

.stat-value.success {
    color: #52c41a;
}

.stat-value.warning {
    color: #faad14;
}

.stat-value.danger {
    color: #ff4d4f;
}

#stats-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.stat-triangle {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    transition: all 0.3s ease;
}

.stat-triangle:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-triangle.active {
    border-left: 4px solid #52c41a;
    background: rgba(82, 196, 26, 0.03);
}

.stat-triangle.inactive {
    border-left: 4px solid #d9d9d9;
    opacity: 0.7;
}

.stat-triangle-name {
    font-weight: 600;
    font-size: 15px;
    color: #1e293b;
}

.stat-triangle-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #5a6a7e;
}

.stat-triangle-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.stat-badge.active {
    background: #52c41a;
    color: #fff;
}

.stat-badge.inactive {
    background: #d9d9d9;
    color: #8c9cae;
}

.stat-badge.profit-high {
    background: #ff4d4f;
    color: #fff;
}

.stat-badge.profit-medium {
    background: #faad14;
    color: #fff;
}

.stat-badge.profit-low {
    background: #52c41a;
    color: #fff;
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-triangle {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stat-triangle-details {
        justify-content: space-between;
    }
}
/* ========== ГЛАВНЫЕ ВКЛАДКИ ========== */
#main-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #ffffff;
    padding: 6px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.main-tab {
    padding: 12px 32px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #8c9cae;
}

.main-tab:hover {
    background: #f0f2f5;
    color: #1e293b;
}

.main-tab.active {
    background: #1677ff;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
}

.main-tab.active:hover {
    background: #0958d9;
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 900px;
    flex-direction: column;
    align-items: center;
}

.tab-content.active {
    display: flex;
}

/* ========== DEX СТАТУС ========== */
.dex-status {
    background-color: #1677ff;
    color: #ffffff;
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
   
    display: inline-block;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.2);
    transition: all 0.3s ease;
}

/* ========== DEX НАСТРОЙКИ ========== */
#dex-settings-container {
    width: 100%;
    margin-bottom: 24px;
}

.dex-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dex-setting-card {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dex-setting-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 12px;
}

.dex-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dex-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: #4a5a6e;
    transition: color 0.2s ease;
}

.dex-checkbox-group label:hover {
    color: #1677ff;
}

.dex-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1677ff;
}

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

.dex-param {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #4a5a6e;
}

.dex-param input[type="number"] {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
    transition: border-color 0.2s ease;
}

.dex-param input[type="number"]:focus {
    outline: none;
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

.dex-param input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1677ff;
}

/* ========== ТОЧЕЧНАЯ НАСТРОЙКА ========== */
.dex-custom-route {
    background: #ffffff;
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.dex-custom-route h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.dex-custom-hint {
    font-size: 13px;
    color: #8c9cae;
    margin-bottom: 16px;
}

.dex-route-builder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.dex-route-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.route-select {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 13px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.route-select:hover {
    border-color: #1677ff;
}

.route-select:focus {
    outline: none;
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

.route-arrow {
    font-size: 18px;
    color: #1677ff;
    font-weight: 700;
}

.dex-route-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== DEX КНОПКИ ========== */
.dex-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dex-btn.primary {
    background: #1677ff;
    color: #ffffff;
}

.dex-btn.primary:hover {
    background: #0958d9;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.dex-btn.secondary {
    background: #f0f2f5;
    color: #4a5a6e;
}

.dex-btn.secondary:hover {
    background: #e0e2e5;
    color: #1e293b;
}

.dex-btn.large {
    padding: 14px 40px;
    font-size: 16px;
}

.dex-btn.small {
    padding: 6px 16px;
    font-size: 12px;
}

.dex-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== DEX РЕЗУЛЬТАТЫ ========== */
#dex-results-container {
    width: 100%;
    margin-bottom: 24px;
}

.dex-summary {
    margin-bottom: 20px;
}

.dex-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.dex-summary-card {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: all 0.3s ease;
}

.dex-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dex-summary-label {
    display: block;
    font-size: 13px;
    color: #8c9cae;
    margin-bottom: 6px;
}

.dex-summary-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.dex-summary-value.profit {
    color: #52c41a;
}

/* ========== DEX ВОЗМОЖНОСТИ ========== */
#dex-opportunities-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dex-opportunity-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.dex-opportunity-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.dex-opportunity-card.profitable {
    border-left: 4px solid #52c41a;
}

.dex-opportunity-card.unprofitable {
    border-left: 4px solid #ff4d4f;
}

.dex-opp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.dex-opp-route {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.dex-opp-profit {
    font-size: 20px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.03);
}

.dex-opp-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #5a6a7e;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

.dex-opp-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.dex-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.dex-step-num {
    width: 20px;
    height: 20px;
    background: #1677ff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.dex-step-desc {
    flex: 1;
    color: #1e293b;
}

.dex-step-dex {
    display: inline-block;
    background: #e6f4ff;
    color: #1677ff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.dex-step-price {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #04b92e;
}

.dex-opp-footer {
    display: flex;
    justify-content: flex-end;
}

/* ========== ДЕТАЛИ СВЯЗКИ ========== */
.dex-route-details {
    margin-top: 20px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dex-route-details.hidden {
    display: none;
}

.dex-route-details h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

.dex-route-detail-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.dex-route-detail-card h5 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 16px 0 10px;
}

.dex-route-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.dex-route-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
}

.dex-route-info-item span {
    font-size: 12px;
    color: #8c9cae;
}

.dex-route-info-item b {
    font-size: 15px;
    color: #1e293b;
}

.dex-route-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dex-route-step {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.dex-route-step-num {
    width: 24px;
    height: 24px;
    background: #1677ff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.dex-route-step-content {
    flex: 1;
}

.dex-route-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

.dex-route-step-header b {
    font-size: 14px;
    color: #1e293b;
}

.dex-route-step-dex {
    display: inline-block;
    background: #e6f4ff;
    color: #1677ff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.dex-route-step-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #5a6a7e;
    font-family: 'Courier New', monospace;
}

/* ========== DEX СТАТИСТИКА ========== */
#dex-stats-container {
    width: 100%;
    margin-top: 24px;
}

#dex-stats-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ========== АДАПТИВ ========== */
@media (max-width: 640px) {
    #main-tabs {
        flex-direction: column;
        width: 100%;
    }
    
    .main-tab {
        padding: 10px 20px;
        font-size: 14px;
        text-align: center;
    }
    
    .dex-settings-grid {
        grid-template-columns: 1fr;
    }
    
    .dex-route-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .route-select {
        width: 100%;
    }
    
    .route-arrow {
        text-align: center;
        transform: rotate(90deg);
    }
    
    .dex-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .dex-opp-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dex-route-info {
        grid-template-columns: 1fr;
    }
}
/* ========== ЗАГОЛОВОК DEX С КНОПКОЙ СПРАВКИ ========== */
.dex-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.dex-help-btn {
    padding: 10px 22px;
    background: #ffffff;
    color: #1677ff;
    border: 2px solid #1677ff;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.1);
    white-space: nowrap;
}

.dex-help-btn:hover {
    background: #1677ff;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
    transform: translateY(-1px);
}

.dex-help-btn:active {
    transform: translateY(0);
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-window {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f2f5;
    background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.3px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f2f5;
    color: #5a6a7e;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #ff4d4f;
    color: #ffffff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ========== СЕКЦИИ СПРАВКИ ========== */
.help-section {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid #f0f2f5;
}

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

.help-section:first-child {
    padding-top: 0;
}

.help-section-num {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.25);
}

.help-section-content {
    flex: 1;
    min-width: 0;
}

.help-section-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.help-section-content p {
    font-size: 14px;
    line-height: 1.7;
    color: #4a5a6e;
    margin-bottom: 8px;
}

.help-section-content p:last-child {
    margin-bottom: 0;
}

.help-section-content b {
    color: #1677ff;
    font-weight: 700;
}

.help-warning {
    background: #fff7e6;
    border-left: 3px solid #faad14;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 10px !important;
    color: #7a5a00 !important;
    font-size: 13px !important;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: flex-end;
    background: #fafbfc;
}

/* ========== АДАПТИВ ========== */
@media (max-width: 640px) {
    .dex-header-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .dex-help-btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-window {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 16px 18px;
    }
    
    .modal-header h2 {
        font-size: 17px;
    }
    
    .modal-body {
        padding: 18px;
    }
    
    .help-section {
        gap: 12px;
        padding: 14px 0;
    }
    
    .help-section-num {
        width: 36px;
        height: 36px;
        font-size: 13px;
        border-radius: 10px;
    }
    
    .help-section-content h3 {
        font-size: 15px;
    }
    
    .help-section-content p {
        font-size: 13px;
    }
    
    .modal-footer {
        padding: 14px 18px;
    }
    
    .modal-footer .dex-btn {
        width: 100%;
    }
}
/* ========== СКРОЛЛ ДЛЯ СПИСКА СЕТЕЙ ========== */
.chains-scrollable {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 8px;
    border: 1px solid #f0f2f5;
    border-radius: 8px;
    padding: 10px;
    background: #fafbfc;
}

.chains-scrollable::-webkit-scrollbar {
    width: 8px;
}

.chains-scrollable::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 4px;
}

.chains-scrollable::-webkit-scrollbar-thumb {
    background: #c0c8d4;
    border-radius: 4px;
}

.chains-scrollable::-webkit-scrollbar-thumb:hover {
    background: #8c9cae;
}

/* Разделитель между EVM и не-EVM */
.chains-scrollable label:has(input[value="solana"]) {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e4e8;
}
/* ========== СПРАВКА: ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ ========== */
.help-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: #1677ff;
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e6f4ff;
    letter-spacing: -0.2px;
}

.help-subtitle:first-of-type {
    margin-top: 8px;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.help-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.6;
    color: #4a5a6e;
}

.help-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #1677ff;
    font-weight: 700;
}

.help-list li b {
    color: #1e293b;
}

.help-code {
    display: block;
    background: #f0f7ff;
    border-left: 3px solid #1677ff;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #0958d9;
    margin: 8px 0;
    overflow-x: auto;
}

.help-section-content code {
    background: #f0f7ff;
    color: #0958d9;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.help-section-content a {
    color: #1677ff;
    text-decoration: none;
    font-weight: 600;
}

.help-section-content a:hover {
    text-decoration: underline;
}

.help-section-content h4 + p {
    margin-top: 6px;
}

/* Увеличим max-height модального окна, т.к. контента стало больше */
.modal-window {
    max-height: 92vh;
}

.modal-body {
    max-height: calc(92vh - 140px);
    overflow-y: auto;
}
/* ========== ЗАГОЛОВОК CEX С КНОПКОЙ СПРАВКИ ========== */
.cex-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ========== ТАБЛИЦА СРАВНЕНИЯ В СПРАВКЕ ========== */
.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.help-table thead {
    background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    color: #ffffff;
}

.help-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.help-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f2f5;
    color: #4a5a6e;
    vertical-align: top;
}

.help-table tr:last-child td {
    border-bottom: none;
}

.help-table tbody tr:hover {
    background: #f8fbff;
}

/* ========== АДАПТИВ ========== */
@media (max-width: 640px) {
    .cex-header-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .cex-header-row .dex-help-btn {
        width: 100%;
        text-align: center;
    }
    
    .help-table {
        font-size: 12px;
    }
    
    .help-table th,
    .help-table td {
        padding: 8px 10px;
    }
}