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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c0e14 0%, #1a1d29 100%);
    color: #e0e0e0;
    min-height: 100vh;
}

.container {




    
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
}

.balance-info {
    display: flex;
    align-items: center;
    margin-left: 20px;
    font-size: 16px;
    color: #ffffff;
}

.balance-info label {
    font-weight: bold;
    margin-right: 8px;
    color: #b8b8b8;
}

.balance-info span {
    font-weight: bold;
    color: #00ff88;
    font-size: 18px;
}



.asset-selector {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-bottom: 8px;
}

.asset-selector label {
    color: #ffffff;
    margin-right: 8px;
    flex-shrink: 0;
}

.asset-selector select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}







.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 150px);
}

.chart-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#chart {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.trading-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contract-selection {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.contract-selection h3 {
    margin-bottom: 20px;
    color: #ffffff;
    font-size: 18px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #b8b8b8;
}

.input-group select,
.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 14px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #00ff88;
}

.min-amount {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    display: block;
}

.direction-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.direction-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.direction-btn.higher {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.direction-btn.higher.active {
    background: #00ff88;
    color: #000;
}

.direction-btn.lower {
    background: rgba(255, 71, 119, 0.2);
    color: #ff4757;
}

.direction-btn.lower.active {
    background: #ff4757;
    color: #fff;
}

.payout-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payout-info p {
    margin: 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.place-order-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    border: none;
    border-radius: 8px;
    color: #000;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.place-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
}

.order-history {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
    overflow-y: auto;
}

.technical-indicators {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.technical-indicators h4 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 14px;
}

.indicator-signals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.signal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.signal-label {
    color: #b8b8b8;
}

.signal-value {
    color: #ffffff;
    font-weight: 500;
}

.signal-value.bullish {
    color: #00ff88;
}

.signal-value.bearish {
    color: #ff4757;
}

.signal-value.neutral {
    color: #ffa500;
}

.confidence-details {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.llm-chat {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.llm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.llm-chat h4 {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
}

.llm-settings-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.llm-settings-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
}

.llm-messages {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.llm-message {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.llm-message.user {
    align-self: flex-end;
    background: rgba(0, 191, 255, 0.15);
    color: #bfe9ff;
}

.llm-message.assistant {
    align-self: flex-start;
    background: rgba(0, 255, 136, 0.12);
    color: #c9ffe7;
}

.llm-message.assistant.stream {
    display: flex;
    flex-direction: column;
    gap: 6px;
    white-space: pre-wrap;
}

.llm-section {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.llm-section-title {
    font-size: 11px;
    color: #b8b8b8;
    margin-bottom: 4px;
}

.llm-section-content {
    font-size: 12px;
    color: #e6fff4;
    white-space: pre-wrap;
}

.llm-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#llm-input {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 12px;
}

#llm-input:focus {
    outline: none;
    border-color: #00ff88;
}

.llm-analysis-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.llm-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    color: #00120a;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.llm-btn.backtest-only-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.llm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.llm-settings-content {
    width: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.llm-settings-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.llm-settings-title {
    font-size: 12px;
    color: #b8b8b8;
}

.llm-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.llm-settings-label {
    font-size: 12px;
    color: #c8c8c8;
}

.llm-settings-input {
    width: 120px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 12px;
}

.llm-settings-input:focus {
    outline: none;
    border-color: #00ff88;
}

.llm-settings-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #c8c8c8;
}

#deepseek-api-key {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 13px;
}

#deepseek-api-key:focus {
    outline: none;
    border-color: #00ff88;
}

.llm-settings-actions {
    display: flex;
    gap: 10px;
}

.llm-cancel-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
}

.llm-settings-status {
    min-height: 18px;
    font-size: 12px;
    color: #ffa500;
}

.confidence-breakdown {
    font-size: 11px;
}

.confidence-title {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
}

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

.confidence-reason {
    color: #b8b8b8;
    flex: 1;
}

.confidence-value {
    color: #00ff88;
    font-weight: 500;
    margin-left: 10px;
}

.order-history h4 {
    margin-bottom: 15px;
    color: #ffffff;
}

.backtest-section {
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backtest-summary {
    font-size: 12px;
    color: #c8c8c8;
    line-height: 1.4;
}

.recent-halfhour-winrate {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    margin-top: 4px;
    margin-bottom: 4px;
}

.recent-halfhour-winrate.high {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.recent-halfhour-winrate.medium {
    color: #FFC107;
    background: rgba(255, 193, 7, 0.1);
}

.recent-halfhour-winrate.low {
    color: #FF5252;
    background: rgba(255, 82, 82, 0.1);
}

.backtest-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #7d5cff 0%, #5a3cff 100%);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.backtest-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(125, 92, 255, 0.25);
}

.orders-list {
    max-height: 300px;
    overflow-y: auto;
}

.order-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.order-item.win {
    border-left-color: #00ff88;
}

.order-item.loss {
    border-left-color: #ff4757;
}

.order-item.refund {
    border-left-color: #ffa500;
}

.order-item.pending {
    border-left-color: #3498db;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: #1a1d29;
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

#modal-title {
    margin-bottom: 20px;
    color: #ffffff;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .chart-container {
        order: -1;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 重置按钮样式 */
.reset-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
    border: 1px solid #ff4757;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(255, 71, 87, 0.3);
    transform: translateY(-1px);
}

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

/* Three Step Future-Trend 准确率显示 */
.trend-accuracy {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.trend-accuracy h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #ffffff;
}

.accuracy-items {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.accuracy-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    min-width: 120px;
}

.trend-period {
    font-size: 14px;
    color: #b0b0b0;
}

.accuracy-value {
    font-size: 14px;
    font-weight: 600;
    color: #4CAF50;
}

.accuracy-change {
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

/* 胜率表格样式 */
.winrate-table {
    border-collapse: collapse;
    display: inline-table;
    margin: 4px 0;
    font-size: 12px;
}

.winrate-table td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    text-align: center;
    min-width: 24px;
}

.symbol-cell {
    color: #ffffff;
    font-weight: bold;
}

.percentage-cell {
    color: #00ff88;
    font-weight: 500;
}
