:root {
    --primary: #4cc9f0;
    --primary-dark: #3277d8;
    --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: #0d1014;
    --bg-light: #151922;
    --bg-lighter: #1d2430;
    --border: rgba(135, 170, 190, 0.26);
    --border-light: rgba(135, 170, 190, 0.16);
    --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;
}

.app-shell {
    min-height: 100vh;
    background: var(--bg-light);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding: 12px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
}

.intro-kicker {
    color: var(--warning);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

h1 {
    margin: 2px 0;
    font-size: 1.35rem;
    line-height: 1.2;
}

.intro-summary,
.risk-note,
.seo-content p {
    color: var(--text-light);
}

.intro-summary {
    font-size: 0.9rem;
}

.risk-note {
    max-width: 360px;
    font-size: 0.82rem;
    text-align: right;
}

.noscript-warning {
    padding: 10px 14px;
    color: var(--warning);
    background: rgba(255, 209, 102, 0.12);
    border-bottom: 1px solid rgba(255, 209, 102, 0.25);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 主图表区域 */
#chart-container {
    width: 100%;
    height: clamp(260px, calc(100vh - 326px), 680px);
    min-height: 0;
    padding: 10px;
    background: var(--bg-light);
}

#funds-chart {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bg-light);
}

/* 控制面板区域 */
#menu {
    padding: 8px;
    width: 100%;
    min-height: 240px;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

.stats-grid {
    display: grid;
    gap: 10px;
}

.menu-grid {
    grid-template-columns: minmax(280px, 0.95fr) minmax(220px, 0.7fr) minmax(320px, 1.2fr);
    align-items: stretch;
}

.input-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ui-panel {
    padding: 12px;
    background: var(--bg-lighter);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    overflow: auto;
}

.panel-title {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.panel-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* 表单元素 */
.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--text);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 按钮样式 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 60px;
}

.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: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    min-width: 0;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--primary);
    word-break: break-all;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0;
    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;
    animation: fadeIn 0.3s ease;
}

.result[hidden] {
    display: none;
}

.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);
}

.seo-content {
    padding: 16px 14px 22px;
    background: var(--bg);
    border-top: 1px solid var(--border-light);
}

.seo-content h2 {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 1rem;
}

.seo-content p {
    max-width: 860px;
    font-size: 0.9rem;
}

.seo-content p + p {
    margin-top: 6px;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .menu-grid {
        grid-template-columns: 1fr 1fr;
    }

    .right-panel {
        grid-column: 1 / -1;
    }

    .input-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .app-header {
        display: block;
        padding: 10px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .risk-note {
        max-width: none;
        margin-top: 6px;
        text-align: left;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #chart-container {
        height: 320px;
        min-height: 240px;
    }

    #menu {
        padding: 5px;
    }

    .right-panel {
        grid-column: auto;
    }

    .input-grid,
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ui-panel {
        padding: 10px;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    #chart-container {
        height: 260px;
        min-height: 220px;
    }

    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);
    }

    .input-grid {
        grid-template-columns: 1fr;
    }
}

/* 触摸设备优化 */
@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;
    }
}
