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

:root {
    --primary-color: #5F0000; /* 暗红色 - 主色调 */
    --primary-hover: #4A0000; /* 暗红色悬停 */
    --accent-color: #5F0000; /* 暗红色 - 强调色 */
    --accent-hover: #4A0000; /* 暗红色悬停 */
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --error-color: #EF4444;
    --bg-color: #F5F5F5; /* 浅灰背景 */
    --card-bg: #FFFFFF;
    --text-primary: #16120F; /* 黑色 - 主文本 */
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* 顶部品牌栏 */
.app-header {
    background: linear-gradient(135deg, #5F0000 0%, #7A0000 100%); /* 暗红色渐变 */
    padding: 20px;
    color: white;
    box-shadow: 0 2px 10px rgba(95, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand-text {
    flex: 1;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 14px;
    margin: 4px 0 0 0;
    opacity: 0.9;
    font-weight: 500;
    display: none; /* 隐藏副标题 */
}

/* 头部操作按钮 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-connect-wallet {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-connect-wallet:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.btn-connect-wallet:active {
    transform: translateY(0);
}

.wallet-info {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
}

.wallet-info:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

#walletAddress {
    color: white;
}

.main-content {
    flex: 1;
    padding-bottom: 80px;
    overflow-y: auto;
    padding-top: 0;
}

.page {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 表单样式 */
.form-container {
    max-width: 100%;
}

.token-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.required {
    color: var(--error-color);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color); /* 暗红色焦点 */
    box-shadow: 0 0 0 3px rgba(95, 0, 0, 0.15);
}

.form-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: -4px;
}

.fee-info {
    background: linear-gradient(135deg, #5F0000 0%, #7A0000 100%); /* 暗红色渐变 */
    padding: 16px;
    border-radius: 12px;
    color: white;
    margin: 8px 0;
}

.fee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.fee-item strong {
    font-size: 20px;
}

.fee-note {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

/* 按钮样式 */
.btn-primary {
    background: var(--accent-color); /* 暗红色 - 主要按钮 */
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(95, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(95, 0, 0, 0.4);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #5A5A5A; /* 更深的灰色 */
}

.btn-secondary.active {
    background: var(--primary-color); /* 暗红色 - 激活状态 */
    color: white;
}

.btn-secondary.active:hover {
    background: var(--primary-hover); /* 悬停时稍亮的红色 */
}

.liquidity-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.liquidity-actions .btn-secondary {
    flex: 1;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
}

/* 浮标按钮组 */
.floating-buttons {
    position: fixed;
    left: 16px;
    bottom: 90px; /* 底部导航栏上方 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-color); /* 暗红色 */
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(95, 0, 0, 0.3);
    transition: all 0.3s ease;
    padding: 0;
}

.floating-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(95, 0, 0, 0.4);
}

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

.floating-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* 暗色主题样式 */
[data-theme="dark"] {
    --bg-color: #16120F; /* 黑色 - 主背景 */
    --card-bg: #1F1B17; /* 稍亮的黑色 */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #3A3329; /* 深色边框 */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .swap-input,
[data-theme="dark"] .liquidity-input {
    background: #16120F; /* 黑色背景 */
    border-color: #3A3329;
}

[data-theme="dark"] .token-selector {
    background: #16120F; /* 黑色背景 */
    border-color: #3A3329;
    color: var(--text-primary);
}

[data-theme="dark"] .token-item:hover {
    background: #1F1B17; /* 稍亮的黑色 */
}

[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .input-wrapper input {
    color: var(--text-primary);
}

[data-theme="dark"] .bottom-nav {
    background: var(--card-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .app-header {
    background: linear-gradient(135deg, #5F0000 0%, #7A0000 100%); /* 暗红色渐变 */
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .card {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-group input {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .wallet-info {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* 移动端浮标按钮调整 */
@media (max-width: 768px) {
    .floating-buttons {
        left: 12px;
        bottom: 85px;
        gap: 10px;
    }
    
    .floating-btn {
        width: 44px;
        height: 44px;
    }
    
    .floating-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .floating-buttons {
        left: 10px;
        bottom: 80px;
        gap: 8px;
    }
    
    .floating-btn {
        width: 40px;
        height: 40px;
    }
    
    .floating-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 24px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-color);
}

.nav-item.active {
    color: var(--accent-color); /* 暗红色 - 激活状态 */
}

.nav-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.success-message {
    color: var(--success-color);
    font-weight: 500;
}

.error-message {
    color: var(--error-color);
    font-weight: 500;
}

.contract-address {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.contract-address label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.address-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.address-display span {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--text-primary);
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.btn-copy {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--primary-hover);
}

.explorer-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.explorer-link:hover {
    text-decoration: underline;
}

/* 个人中心样式 */
.profile-container {
    max-width: 100%;
}

.search-section {
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.contracts-count {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contract-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.contract-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.contract-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.token-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.token-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.5;
}

.token-logo-placeholder svg {
    width: 24px;
    height: 24px;
}

.token-logo-small {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.token-logo-display {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.token-logo-display img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.token-logo-display svg {
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    opacity: 0.6;
}

.token-logo-container {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    flex-shrink: 0;
}

.token-info {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 12px;
    flex: 1;
}

.token-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.contract-name h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.token-symbol {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-deployed {
    background: #D1FAE5;
    color: #065F46;
}

.status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.status-failed {
    background: #FEE2E2;
    color: #991B1B;
}

.contract-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.detail-item label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.detail-item span {
    color: var(--text-primary);
}

.contract-address-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.contract-address-item label {
    width: 100%;
}

.address-text {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
}

.btn-copy-small {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy-small:hover {
    background: var(--primary-hover);
}

.btn-copy-small.copied {
    background: var(--success-color);
}

.tx-link {
    color: var(--primary-color);
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.tx-link:hover {
    text-decoration: underline;
}

.contract-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.link-item {
    padding: 6px 12px;
    background: var(--bg-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.link-item:hover {
    background: var(--primary-color);
    color: white;
}

/* AresSwap 样式 */
.swap-container {
    max-width: 100%;
}

.swap-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent-color); /* 暗红色 - 激活状态 */
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
}

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

.swap-card, .liquidity-card, .pools-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.swap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.swap-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.btn-icon {
    background: var(--bg-color);
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--border-color);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-primary);
}

/* K线图样式 */
.chart-time-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-time-btn:hover {
    background: var(--border-color);
}

.chart-time-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#chartContainer {
    margin-bottom: 20px;
}

#tradingview_chart {
    position: relative;
}

.swap-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.swap-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px; /* 减少header和input之间的间距 */
}

.swap-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px; /* 添加额外的底部间距 */
}

.swap-input, .liquidity-input {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.swap-input input {
    flex: 1;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    padding: 0;
}

.swap-input input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.token-select-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    max-width: 140px;
    justify-content: center;
    height: 36px;
}

.token-select-btn.has-token {
    justify-content: flex-start;
    padding: 6px 10px;
}

.token-select-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.token-btn-logo {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.token-btn-placeholder {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.token-btn-placeholder svg {
    width: 100%;
    height: 100%;
}

.token-btn-symbol {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.swap-switch-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.swap-switch-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
    transform: rotate(180deg);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 8px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item span:first-child {
    color: var(--text-secondary);
}

.info-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.balance {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 13px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden; /* 防止内容溢出 */
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    padding: 0;
}

.input-wrapper input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.token-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 40px;
    flex-shrink: 0; /* 防止收缩 */
    margin-left: auto; /* 右对齐 */
}

.token-selector .token-logo-display {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.token-selector #fromTokenSymbol,
.token-selector #toTokenSymbol {
    flex-shrink: 0;
    text-align: left;
    white-space: nowrap; /* 防止文本换行 */
}

.token-selector:hover {
    border-color: var(--accent-color); /* 暗红色悬停 */
}

.token-selector svg {
    width: 16px;
    height: 16px;
}

.swap-arrow {
    display: flex;
    justify-content: center;
    margin: 8px 0; /* 调整间距，让两个输入组之间有合适的距离 */
    z-index: 1;
}

/* 流动性页面中两个输入组之间的间距优化 */
#liquidityTab .swap-input-group {
    margin-bottom: 8px; /* 为流动性页面的输入组添加底部间距 */
}

#liquidityTab .swap-input-group:last-of-type {
    margin-bottom: 0; /* 最后一个输入组不需要底部间距 */
}

#liquidityTab .swap-arrow {
    margin: 12px 0; /* 流动性页面中分隔符的间距 */
}

.swap-arrow svg {
    width: 24px;
    height: 24px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.swap-info, .liquidity-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 8px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row span:first-child {
    color: var(--text-secondary);
}

.info-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.btn-swap, .btn-liquidity {
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    font-size: 18px;
}

.liquidity-input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.liquidity-plus {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: -8px 0;
}

.liquidity-divider {
    height: 1px;
    background: var(--border-color);
    margin: 32px 0;
}

.liquidity-preview {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.preview-item:last-child {
    margin-bottom: 0;
}

.btn-max {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-max:hover {
    background: var(--primary-hover);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.pools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pools-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.pools-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pool-tokens {
    font-weight: 600;
    font-size: 16px;
}

.pool-tvl {
    color: var(--text-secondary);
    font-size: 14px;
}

.pools-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.modal-token {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.token-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 16px;
}

.token-search:focus {
    outline: none;
    border-color: var(--accent-color); /* 暗红色焦点 */
    box-shadow: 0 0 0 3px rgba(95, 0, 0, 0.15);
}

.token-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.token-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.token-item:hover {
    background: var(--bg-color);
    border-color: var(--border-color);
}

.token-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.token-logo-container {
    flex-shrink: 0;
}

.token-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* 允许收缩 */
}

.token-info strong {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.token-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    /* SWAP页面组件缩小 */
    .swap-container {
        transform: scale(0.95);
        transform-origin: top center;
    }
    
    .swap-tabs {
        gap: 4px;
        margin-bottom: 16px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .swap-card, .liquidity-card, .pools-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .swap-header {
        margin-bottom: 16px;
    }
    
    .swap-header h3 {
        font-size: 18px;
    }
    
    .swap-input-group {
        gap: 12px;
    }
    
    .swap-input, .liquidity-input {
        padding: 12px;
        border-radius: 10px;
    }
    
    .input-header {
        margin-bottom: 8px;
        font-size: 12px;
    }
    
    .balance {
        font-size: 11px;
    }
    
    .input-wrapper {
        gap: 6px;
        padding: 0 2px; /* 添加内边距防止溢出 */
    }
    
    .input-wrapper input {
        font-size: 18px;
        min-width: 0; /* 允许输入框缩小 */
        flex: 1 1 auto; /* 允许收缩 */
    }
    
    .token-selector {
        padding: 6px 8px;
        font-size: 13px;
        gap: 4px;
        flex-shrink: 0; /* 防止选择器收缩 */
        margin-left: auto; /* 确保右对齐 */
    }
    
    .token-selector svg {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
    }
    
    .token-selector #fromTokenSymbol,
    .token-selector #toTokenSymbol {
        font-size: 13px;
        max-width: 80px; /* 限制最大宽度 */
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .token-select-btn {
        padding: 5px 10px;
        font-size: 12px;
        gap: 5px;
        min-width: 90px;
        max-width: 120px;
        height: 32px;
    }
    
    .token-select-btn.has-token {
        padding: 5px 8px;
    }
    
    .token-btn-logo {
        width: 16px;
        height: 16px;
    }
    
    .token-btn-placeholder {
        width: 16px;
        height: 16px;
    }
    
    .token-btn-symbol {
        font-size: 12px;
        max-width: 70px;
    }
    
    .swap-arrow {
        margin: -6px 0;
    }
    
    .swap-arrow svg {
        width: 20px;
        height: 20px;
        padding: 6px;
    }
    
    .swap-info, .liquidity-info {
        margin-top: 12px;
        padding: 12px;
        font-size: 12px;
    }
    
    .info-row {
        font-size: 12px;
        padding: 6px 0;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-icon {
        padding: 6px;
    }
    
    .btn-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .token-logo-display {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 12px;
    }
    
    .page-header {
        padding: 16px 12px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .page-header .subtitle {
        font-size: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 16px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .contract-header {
        flex-direction: column;
        gap: 12px;
    }
    
    /* SWAP页面进一步缩小 */
    .swap-container {
        transform: scale(0.9);
        transform-origin: top center;
    }
    
    .swap-card, .liquidity-card, .pools-card {
        padding: 12px;
    }
    
    .swap-header h3 {
        font-size: 16px;
    }
    
    .input-wrapper {
        gap: 4px;
        padding: 0 1px; /* 进一步减少间距 */
    }
    
    .input-wrapper input {
        font-size: 16px;
        min-width: 0;
        flex: 1 1 auto;
    }
    
    .token-selector {
        padding: 5px 6px;
        font-size: 12px;
        gap: 3px;
        flex-shrink: 0;
        margin-left: auto;
    }
    
    .token-selector svg {
        width: 10px;
        height: 10px;
    }
    
    .token-selector #fromTokenSymbol,
    .token-selector #toTokenSymbol {
        font-size: 12px;
        max-width: 60px;
    }
    
    .token-select-btn {
        padding: 4px 8px;
        font-size: 11px;
        gap: 4px;
        min-width: 80px;
        max-width: 100px;
        height: 28px;
    }
    
    .token-select-btn.has-token {
        padding: 4px 6px;
    }
    
    .token-btn-logo {
        width: 14px;
        height: 14px;
    }
    
    .token-btn-placeholder {
        width: 14px;
        height: 14px;
    }
    
    .token-btn-symbol {
        font-size: 11px;
        max-width: 60px;
    }
    
    .pools-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .token-modal {
        padding: 12px;
    }
    
    .token-modal-header h2 {
        font-size: 18px;
    }
    
    .token-item {
        padding: 10px 12px;
    }
    
    .token-info {
        gap: 8px;
    }
    
    .token-logo-container {
        width: 28px;
        height: 28px;
        margin-right: 0; /* 移除右边距，使用gap */
        flex-shrink: 0;
    }
    
    .token-details {
        gap: 2px;
    }
    
    .token-info strong {
        font-size: 14px;
    }
    
    .token-info span {
        font-size: 11px;
    }
    
    .token-logo-small {
        width: 28px;
        height: 28px;
    }
}

