:root {
    --primary: #4cc9f0;
    --primary-dark: #4361ee;
    --success: #52b788;
    --danger: #ef476f;
    --warning: #ffd166;
    --text: rgba(255, 255, 255, 0.95);
    --text-light: rgba(255, 255, 255, 0.8);
    --text-lighter: rgba(255, 255, 255, 0.6);
    --bg: #0a0a12;
    --bg-light: #121220;
    --bg-lighter: #1a1a2e;
    --border: rgba(100, 100, 200, 0.25);
    --border-light: rgba(100, 100, 200, 0.15);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: all 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell,
        'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px 20px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* 数据表格区域 */
#data-table-container {
    width: 100%;
    height: 30vh;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.table-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.table-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
}

#data-count {
    font-size: 0.85rem;
    color: var(--text-lighter);
}

#data-table-wrapper {
    flex: 1;
    overflow: auto;
    padding: 10px;
}

#stock-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#stock-data-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-lighter);
    z-index: 100;
}

#stock-data-table th {
    padding: 8px 12px;
    text-align: left;
    color: var(--primary);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    background: var(--bg-lighter);
    position: relative;
}

#stock-data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-light);
}

#stock-data-table tbody tr:hover {
    background: rgba(76, 201, 240, 0.05);
}

.no-data {
    text-align: center !important;
    color: var(--text-lighter) !important;
    padding: 20px !important;
}

/* 主图表区域 */
#chart-container {
    width: 100%;
    height: calc(70vh - 280px);
}

#funds-chart {
    width: 100%;
    height: 100%;
    background: var(--bg-light);
    padding: 10px;
}

/* 控制面板区域 */
#menu {
    padding: 12px;
    width: 100%;
    height: 280px;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

.control-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    height: 100%;
}

.params-panel {
    display: flex;
    flex-direction: column;
}

.stats-panel {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    flex: 1;
}

.ui-panel {
    padding: 8px;
    background: var(--bg-lighter);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    max-height: 100%;
    overflow: auto;
}

.panel-title {
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.panel-title svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 表单元素 */
.form-group {
    display: flex;
    flex-direction: column;
}

.status-display {
    text-align: center;
    padding: 6px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-light);
}

#simulation-status,
#current-date-display {
    color: var(--primary);
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* 按钮样式 */
.button-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: auto;
}

button {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 50px;
}

.btn-primary {
    background-color: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background-color: rgba(100, 100, 200, 0.25);
    color: var(--text);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 统计信息 */
.stat-item {
    text-align: center;
    padding: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    min-width: 0;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--primary);
    word-break: break-all;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

/* 策略说明 */
.strategy-description {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

/* 当前投注样式 */
.current-bet {
    text-align: center;
    padding: 12px;
    margin: 15px 0;
}

.current-bet-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 5px 0;
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

/* 结果提示 */
.result {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    display: none;
    animation: fadeIn 0.3s ease;
}

.win {
    background: rgba(82, 183, 136, 0.15);
    color: var(--success);
    border: 1px solid rgba(82, 183, 136, 0.25);
}

.loss {
    background: rgba(239, 71, 111, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 71, 111, 0.25);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    #chart-container {
        height: calc(100vh - 300px);
    }

    #menu {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #chart-container {
        height: calc(100vh - 500px);
        min-height: 250px;
    }

    #menu {
        height: 500px;
        padding: 5px;
    }

    .ui-panel {
        padding: 10px;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    #chart-container {
        height: calc(100vh - 550px);
        min-height: 200px;
    }

    #menu {
        height: 550px;
    }

    button {
        padding: 8px;
        font-size: 0.85rem;
    }

    .current-bet-value {
        font-size: 1.3rem;
    }

    .button-group {
        flex-wrap: wrap;
    }

    .button-group button {
        min-width: calc(50% - 5px);
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    button:hover {
        transform: none !important;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 打印样式 */
@media print {
    #menu {
        display: none;
    }

    #chart-container {
        height: 100vh;
    }
}