/* ========== 全局样式 ========== */
:root {
    --primary: #4f8cff;
    --primary-dark: #3a6fd8;
    --danger: #ff5c5c;
    --warning: #ffb340;
    --success: #34c759;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6e7191;
    --border: #e4e6f0;
    --radius: 16px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

/* ========== 页面切换 ========== */
.page {
    display: none;
    padding: 20px 16px 40px;
    min-height: 100vh;
    animation: fadeSlideIn 0.3s ease;
}
.page.active { display: block; }

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

/* ========== 首页 ========== */
.home-hero {
    text-align: center;
    padding: 40px 0 24px;
    position: relative;
}
.eye-icon {
    font-size: 72px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.home-hero h1 {
    font-size: 28px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 16px 0 8px;
}
.home-hero .subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.home-features { margin: 24px 0; }
.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.feature-icon { font-size: 32px; flex-shrink: 0; }
.feature-item strong { display: block; margin-bottom: 2px; }
.feature-item p { color: var(--text-secondary); font-size: 13px; }

.disclaimer-compact {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 16px 0;
    margin-top: 8px;
}

/* ========== 页面头部 ========== */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; }
.btn-back {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}

/* ========== 表单 ========== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--card);
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-group textarea { resize: vertical; font-family: inherit; }

.gender-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.gender-btn {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.gender-btn.active {
    border-color: var(--primary);
    background: #eef3ff;
    font-weight: 600;
}

/* ========== 按钮 ========== */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin: 16px 0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--card);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 17px;
    cursor: pointer;
    margin: 8px 0;
}

/* ========== 拍照页 ========== */
/* ========== 上传照片页 ========== */
.upload-area {
    width: 100%;
    aspect-ratio: 1;
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--card);
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area:active {
    border-color: var(--primary);
    background: #f8f9ff;
}
.upload-icon { font-size: 64px; margin-bottom: 12px; }
.upload-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.upload-hint { font-size: 13px; color: var(--text-secondary); }

.guide-tips {
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.guide-tips h4 { margin-bottom: 8px; }
.guide-tips ul { padding-left: 20px; }
.guide-tips li {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.photo-preview { margin-top: 16px; text-align: center; }
.photo-preview img {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

/* ========== 分析中 ========== */
.analyzing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
}
.analyzing-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
}
.pulse-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--primary);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}
.pulse-ring.delay-1 { animation-delay: 0.6s; }
.pulse-ring.delay-2 { animation-delay: 1.2s; }
@keyframes pulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}
.eye-icon.analyzing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    animation: float 2s ease-in-out infinite;
}
.analyzing-detail { color: var(--text-secondary); font-size: 14px; margin-top: 8px; }
.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--gradient);
    width: 0%;
    transition: width 0.5s ease;
}

/* ========== 报告页 ========== */
#report-content { padding: 16px 0; }
.report-score { text-align: center; padding: 24px; }
.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
}
.score-circle.good { background: linear-gradient(135deg, #667eea, #764ba2); }
.score-circle.moderate { background: linear-gradient(135deg, #f093fb, #f5576c); }
.score-circle.caution { background: linear-gradient(135deg, #fa709a, #fee140); color: #333; }
.score-label { font-size: 14px; font-weight: 400; margin-top: -4px; }

.report-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.report-card h3 {
    font-size: 17px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.report-card h3 .indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.indicator.good { background: var(--success); }
.indicator.moderate { background: var(--warning); }
.indicator.caution { background: var(--danger); }

.organ-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.organ-item:last-child { border-bottom: none; }
.organ-name { font-weight: 500; }
.organ-status {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 20px;
}
.organ-status.good { background: #e8f8ee; color: #15803d; }
.organ-status.moderate { background: #fef9e7; color: #a16207; }
.organ-status.caution { background: #fef2f2; color: #dc2626; }

.report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 0;
}

/* ========== Modal ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    text-align: center;
}
.modal-content h3 { margin-bottom: 16px; }
.modal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
    text-align: left;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 200;
    transition: transform 0.3s ease;
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ========== 专业报告新增样式 ========== */
.section-title {
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    color: var(--text);
}

/* 体质评估 */
.constitution-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.density-gauge, .constitution-types { padding: 12px 0; }
.gauge-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.gauge-bar-bg {
    width: 100%;
    height: 10px;
    background: #e4e6f0;
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0;
}
.gauge-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}
.gauge-value { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 标签 */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px 4px 2px 0;
}
.tag-blue { background: #eef3ff; color: #3a6fd8; }

.info-row {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.5;
}
.info-row:first-of-type { border-top: none; }
.info-label {
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    min-width: 70px;
}

/* 系统扫描 */
.system-block { transition: all 0.2s; }
.system-header { user-select: none; }
.system-detail.collapsed { display: none; }

.clock-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eef3ff;
    color: #3a6fd8;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.sign-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #fff3e0;
    color: #e65100;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* 风险项 */
.risk-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.check-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 响应式 ========== */
@media (max-width: 360px) {
    .home-hero h1 { font-size: 24px; }
    .eye-icon { font-size: 56px; }
}
