:root {
    --primary: #1a73e8;
    --primary-dark: #0d47a1;
    --secondary: #f57c00;
    --success: #34a853;
    --warning: #f9ab00;
    --danger: #ea4335;
    --dark: #121c2d;
    --darker: #0a1425;
    --light: #f5f8fa;
    --gray: #6c757d;
    --card-bg: rgba(25, 40, 65, 0.92);
    --position-bg: rgba(30, 45, 70, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--darker), var(--dark));
    color: var(--light);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
}

/* 顶部应用栏 */
.app-bar {
    background: rgba(15, 30, 55, 0.95);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #4285f4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon i {
    font-size: 20px;
    color: white;
}

.app-title h1 {
    font-size: 1.3rem;
    font-weight: 600;
    background: linear-gradient(to right, #8ab4f8, #34a853);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 主内容区 */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #bbdefb;
}

.section-title i {
    color: var(--primary);
}

/* 输入组样式 */
.input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #bbdefb;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 18px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 16px 16px 16px 50px;
    border-radius: 12px;
    border: none;
    background: rgba(30, 45, 70, 0.8);
    color: white;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
    background: rgba(40, 55, 80, 0.9);
}

/* 模式切换器 */
.mode-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #bbdefb;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.mode-btn.active {
    background: var(--primary);
    font-weight: bold;
}

/* 按钮样式 */
.btn {
    padding: 16px;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(33, 150, 243, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    margin-top: 5px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 结果展示 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.result-card {
    background: rgba(30, 45, 70, 0.6);
    border-radius: 15px;
    padding: 18px 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    background: rgba(40, 55, 80, 0.7);
}

.result-card h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #bbdefb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* 颜色定义 */
.risk-color { color: #ff5252; }
.reward-color { color: #69f0ae; }
.ratio-color { color: #ffd740; }
.kelly-color { color: #bb86fc; }

/* 仓位建议 */
.position-advice {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    background: var(--position-bg);
    border-left: 4px solid var(--primary);
}

.position-advice p {
    margin-bottom: 8px;
    line-height: 1.6;
}

.position-advice strong {
    font-weight: 600;
}

/* 风险等级标记 */
.risk-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 8px;
}

.risk-low { background: var(--success); }
.risk-moderate { background: var(--warning); }
.risk-high { background: var(--danger); }

/* 仓位详情 */
.position-details {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
}

.position-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.position-row:last-child {
    border-bottom: none;
}

/* 凯利公式说明 */
.kelly-note {
    background: rgba(25, 40, 65, 0.8);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    border-left: 3px solid var(--warning);
}

/* 历史记录 */
.history-container {
    margin-top: 25px;
}

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

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.history-item {
    background: rgba(30, 45, 70, 0.6);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    cursor: pointer;
}

.history-item:hover {
    background: rgba(40, 55, 80, 0.7);
    transform: translateX(5px);
}

.history-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    color: #bbdefb;
}

.history-date {
    font-size: 0.8rem;
    color: #8ab4f8;
}

.history-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.9rem;
}

.history-detail {
    display: flex;
    justify-content: space-between;
}

.history-detail span:first-child {
    color: #bbdefb;
}

/* 响应式调整 */
@media (max-width: 600px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .history-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 400px) {
    .app-title h1 {
        font-size: 1.1rem;
    }

    .card {
        padding: 20px 15px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 提示信息 */
.info-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    cursor: help;
}

.info-tooltip .tooltip-text {
    visibility: hidden;
    width: 220px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 表格样式 */
.info-table {
    width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
}

.info-table th, .info-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-table th {
    color: #8ab4f8;
    font-weight: 500;
}

/* 无历史记录 */
.empty-history {
    text-align: center;
    padding: 30px;
    color: #8ab4f8;
    font-style: italic;
}

/* 进度条样式 */
.position-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-low { background: var(--success); }
.progress-moderate { background: var(--warning); }
.progress-high { background: var(--danger); }
