/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* 优化字体栈：系统字体优先，更好的中文支持 */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* 头部样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

header h1 {
    color: #2d3748;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.update-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.update-info span {
    color: #718096;
    font-size: 0.9rem;
    font-weight: 500;
}

#refresh-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

#refresh-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#refresh-btn:active {
    transform: scale(0.98);
}

/* 时间选择器 */
.time-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.time-selector label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #2d3748;
    letter-spacing: 0.01em;
}

.time-btn {
    padding: 8px 18px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #4a5568;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.01em;
}

.time-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f7fafc;
}

.time-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

/* 卡片容器 */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* BTC 卡片 - 橙色渐变 */
.btc-card {
    background: linear-gradient(135deg, #eab65d 0%, #ea580c 100%);
}

.btc-card:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

/* ETH 卡片 - 蓝色渐变 */
.eth-card {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.eth-card:hover {
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.95;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.card-value {
    font-size: 2.8rem;
    font-weight: 800;
    margin: 12px 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.card-direction {
    font-size: 2rem;
    font-weight: 800;
    margin: 12px 0;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-direction.long {
    color: #4ade80;
}

.card-direction.short {
    color: #f87171;
}

.card-detail {
    display: flex;
    justify-content: space-between;
    margin: 16px 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.card-detail strong {
    font-weight: 700;
    font-size: 1.05rem;
}

.card-percent {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 12px 0;
    letter-spacing: -0.01em;
}

.card-time {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 12px;
    font-weight: 500;
}

/* 图表容器 */
.chart-container {
    margin-bottom: 40px;
    background: #f8f9fa;
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-container h2 {
    color: #2d3748;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.chart {
    width: 100%;
    height: 450px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    header h1 {
        font-size: 1.75rem;
    }

    .card-value {
        font-size: 2.4rem;
    }

    .card-direction {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
        padding: 15px;
    }

    .container {
        padding: 20px;
    }

    header {
        flex-direction: column;
        gap: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .time-selector {
        flex-wrap: wrap;
    }

    .time-selector label {
        font-size: 0.9rem;
    }

    .time-btn {
        font-size: 0.85rem;
        padding: 7px 15px;
    }

    .cards-container {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 22px;
    }

    .card h3 {
        font-size: 1rem;
    }

    .card-value {
        font-size: 2.2rem;
    }

    .card-direction {
        font-size: 1.6rem;
    }

    .card-percent {
        font-size: 1.5rem;
    }

    .chart-container h2 {
        font-size: 1.25rem;
    }

    .chart {
        height: 350px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    header h1 {
        font-size: 1.35rem;
    }

    .card-value {
        font-size: 2rem;
    }

    .card-direction {
        font-size: 1.5rem;
    }

    .chart {
        height: 300px;
    }
}

/* 加载动画 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

/* 改善文本渲染 */
h1, h2, h3, h4, h5, h6 {
    text-rendering: optimizeLegibility;
}

button, input, select, textarea {
    font-family: inherit;
}

/* 辅助工具类 */
.font-mono {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', monospace;
}
