/* --- 基础变量 --- */
:root {
    --primary: #212121;
    --gain: #00BFA5;
    --loss: #FF5722;
    --bg: #F5F7F9;
    --card: #FFFFFF;
    --text-main: #333333;
    --text-sub: #757575;
    --radius: 16px;
}

/* --- 全局布局 --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    width: 100%;
    max-width: 414px;
    background: var(--card);
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* --- 头部 --- */
header {
    padding: 20px 24px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.5px; }
.logo span { color: var(--gain); }

/* --- 屏幕切换与动画 --- */
.screen {
    padding: 24px;
    flex: 1;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.screen.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 组件样式 --- */
h2 { font-size: 1.6rem; margin: 0 0 8px 0; font-weight: 700; letter-spacing: -0.5px; }
p.desc { color: var(--text-sub); margin-bottom: 24px; line-height: 1.5; font-size: 0.95rem; }

/* 场景选择卡片 */
.scene-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.scene-card { border: 2px solid #f0f0f0; border-radius: 16px; padding: 20px 10px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fff; }
.scene-card:active { transform: scale(0.96); }
.scene-card.selected { border-color: var(--primary); background-color: #fafafa; }
.scene-icon { font-size: 2rem; margin-bottom: 8px; display: block; }
.scene-name { font-size: 0.9rem; font-weight: 600; color: var(--text-main); }

/* 输入控件 */
.input-group { margin-bottom: 24px; }
label { display: block; font-size: 0.85rem; color: var(--text-sub); margin-bottom: 8px; font-weight: 600; }
input[type="number"] {
    width: 100%; padding: 18px; font-size: 1.3rem; border: 2px solid #f0f0f0; border-radius: 12px;
    box-sizing: border-box; transition: border-color 0.2s; font-family: inherit; background: #fafafa; font-weight: 600;
}
input[type="number"]:focus { outline: none; border-color: var(--primary); background: #fff; }
input[type="range"] { width: 100%; margin: 15px 0; accent-color: var(--primary); }

/* 按钮 */
.btn {
    background: var(--primary); color: white; border: none; padding: 18px; border-radius: var(--radius);
    font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: auto; box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: transform 0.1s; width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #f0f0f0; color: var(--text-main); box-shadow: none; }

/* 结果卡片 */
.score-card { background: #fff; border-radius: 20px; padding: 24px; margin-bottom: 24px; border: 1px solid #eee; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.metric-group { margin-bottom: 24px; }
.metric-header { display: flex; align-items: flex-start; margin-bottom: 10px; }
.metric-icon { font-size: 1.6rem; margin-right: 12px; line-height: 1; margin-top: 2px; }
.metric-info { flex: 1; }
.metric-title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.metric-desc { font-size: 0.8rem; color: var(--text-sub); margin-top: 4px; line-height: 1.3; }
.metric-val { font-weight: 800; font-size: 1.3rem; margin-left: 10px; white-space: nowrap; }

.bar-bg { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; width: 100%; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }

/* 辅助色与类 */
.bg-gain { background-color: var(--gain); }
.bg-loss { background-color: var(--loss); }
.text-gain { color: var(--gain); }
.text-loss { color: var(--loss); }

/* 图表与洞察 */
canvas { width: 100%; height: 220px; background: #fff; margin-bottom: 0px; }
.chart-legend { margin-bottom: 20px; font-size: 0.8rem; color: #666; background: #f9f9f9; padding: 12px; border-radius: 8px; }

.insight-box { background: #E0F2F1; color: #00695C; padding: 16px; border-radius: 12px; font-size: 0.9rem; line-height: 1.6; border-left: 4px solid var(--gain); }
.insight-box.warning { background: #FFF3E0; color: #E65100; border-left-color: var(--loss); }

.tuner-card { background: #fff; padding: 20px; border-radius: 16px; border: 1px solid #eee; margin-bottom: 20px; }
.helper-bubble { font-size: 0.8rem; color: #E65100; background: #FFF3E0; padding: 10px; border-radius: 8px; margin-top: 8px; display: none; }