/* ============================================
   幼儿心理类型测评 - 3-6岁家长代测版
   风格：复刻 11-14岁版精致融合风格 (Blue & Orange)
   ============================================ */

/* ========== 设计令牌 (完全复刻 11-14) ========== */
:root {
    --primary: #5B8FB9;           /* 主色：蓝 */
    --primary-soft: #EEF5FA;
    --primary-dark: #4A7A9E;
    
    --accent-orange: #F5A574;     /* 强调色：橙 */
    --accent-orange-soft: #FFF4ED;
    --accent-blue: #5B8FB9;
    --accent-blue-soft: #EEF5FA;
    
    --bg: #F8F9FB;
    --bg-card: #FFFFFF;
    
    --text: #2C2C2C;
    --text-sub: #5A5A5A;
    --text-hint: #9A9A9A;
    
    --line: #E5E5E5;
    --line-dash: #D0D0D0;
    
    --success: #22C55E;
    --warning: #F59E0B;
    
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-card: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 11-14版特有的彩虹渐变 */
    --rainbow: linear-gradient(135deg, #FF6B6B, #FFA94D, #FFE066, #69DB7C, #4DABF7, #9775FA);
    --rainbow-light: linear-gradient(135deg, rgba(255,107,107,0.15), rgba(255,169,77,0.15), rgba(255,224,102,0.15), rgba(105,219,124,0.15), rgba(77,171,247,0.15), rgba(151,117,250,0.15));
    --progress-gradient: var(--rainbow);
}

/* ========== 基础重置 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Nunito', 'Noto Sans SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 页面容器 ========== */
.page { display: none; min-height: 100vh; flex-direction: column; animation: fadeIn 0.4s var(--ease); }
.page.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ========== 组件样式 ========== */
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-outlined { background: var(--bg-card); border: 2px dashed var(--line-dash); border-radius: var(--radius-lg); position: relative; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 14px 20px; border-radius: var(--radius-md); font-weight: 700; font-size: 15px; border: none; cursor: pointer; transition: all 0.2s; gap: 6px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(91, 143, 185, 0.3); }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-outline { background: white; border: 1px solid var(--line); color: var(--text-sub); }
.btn-block { width: 100%; }

/* 胶囊标签 */
.pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; gap: 4px; }
.pill-blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.pill-orange { background: var(--accent-orange-soft); color: var(--accent-orange); }

/* Toast */
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: white; padding: 10px 20px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.3s; z-index: 9999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-10px); }

/* ========== 首页 (Home) ========== */
.home-page { padding: 30px 24px 40px; max-width: 480px; margin: 0 auto; position: relative; }

/* 品牌区 */
.home-brand { text-align: center; margin-top: 20px; position: relative; z-index: 1; margin-bottom: 24px; }
.home-brand-name { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.home-brand-sub { font-size: 13px; color: var(--text-sub); letter-spacing: 1px; }

/* 空占位符 */
.home-spacer-top { height: 16px; }

.home-feature { padding: 24px; position: relative; z-index: 1; margin-bottom: 20px; background: linear-gradient(180deg, #FFFFFF 0%, #F5FBF8 100%); }
.feature-icons { display: flex; justify-content: center; gap: 12px; margin-bottom: 16px; font-size: 22px; }
.feature-icon-item { width: 44px; height: 44px; background: #FFF; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.feature-content { text-align: center; }
.feature-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.feature-desc { font-size: 13px; color: var(--text-sub); margin-bottom: 16px; }
.feature-pills { display: flex; justify-content: center; gap: 10px; }

.home-entries { width: 100%; position: relative; z-index: 1; }
.entry-card { display: flex; align-items: center; gap: 16px; padding: 20px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-card); }
.entry-card:hover { transform: translateY(-2px); }
.entry-icon { width: 52px; height: 52px; background: var(--primary-soft); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; } /* 缩小图标字号 */
.entry-body { flex: 1; }
.entry-title { font-weight: 700; font-size: 16px; color: var(--text); }
.entry-hint { font-size: 12px; color: var(--text-hint); }
.entry-arrow { width: 30px; height: 30px; background: #F3F4F6; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); }

.resume-section { width: 100%; margin-top: 12px; }
.resume-btn { padding: 12px 16px; background: white; border: 1px solid var(--primary); border-radius: var(--radius-md); display: flex; justify-content: space-between; align-items: center; color: var(--primary); font-weight: 600; font-size: 13px; cursor: pointer; }

.footer-copyright { margin-top: 30px; text-align: center; font-size: 11px; color: #CCC; }

/* ========== 输入与引导页 (优化样式) ========== */
.name-page, .intro-page { align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, #F0FBF7 0%, #FFF 100%); }
.name-card, .intro-card { width: 100%; max-width: 400px; padding: 32px 24px; text-align: center; box-shadow: var(--shadow-card); background: #FFF; border-radius: 20px; }

/* 昵称页优化 */
.name-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.name-desc { font-size: 13px; color: var(--text-sub); margin-bottom: 24px; }
.name-input { width: 100%; padding: 14px; text-align: center; font-size: 18px; border: 2px solid #EEE; border-radius: 12px; margin-bottom: 24px; outline: none; transition: 0.2s; font-weight: 600; color: var(--primary-dark); }
.name-input:focus { border-color: var(--primary); background: #FAFFFC; }

.intro-emoji { font-size: 48px; margin-bottom: 16px; }
.intro-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 20px; }
.intro-text { text-align: left; font-size: 15px; color: #555; line-height: 1.8; margin-bottom: 24px; }
.intro-text p { margin-bottom: 12px; }
.intro-text strong { color: var(--primary-dark); font-weight: 700; }
.intro-highlight { color: var(--accent-orange); font-weight: 800; text-align: center; display: block; margin-top: 20px; font-size: 16px; border-top: 1px dashed #eee; padding-top: 16px; }

/* ========== 答题页 (Quiz) ========== */
.quiz-header { position: sticky; top: 0; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); z-index: 10; padding: 12px 20px; border-bottom: 1px solid #F0F0F0; }
.quiz-nav { text-align: center; margin-bottom: 8px; font-weight: 700; color: var(--primary); font-size: 13px; }

.quiz-progress { display: flex; flex-direction: column; }
.progress-track { height: 8px; background: #E5E7EB; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--progress-gradient); transition: width 0.3s var(--ease); }
.progress-info { display: flex; justify-content: center; font-size: 12px; color: #999; margin-top: 6px; }

.quiz-body { flex: 1; max-width: 600px; margin: 0 auto; width: 100%; padding: 24px 20px; }
.question-card { animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.quiz-tip { background: #FFF7ED; color: #C2410C; font-size: 12px; padding: 10px 16px; border-radius: 10px; margin-bottom: 20px; text-align: center; line-height: 1.5; }
.question-text { font-size: 18px; font-weight: 700; color: #111; text-align: center; margin-bottom: 30px; line-height: 1.5; min-height: 60px; }

/* 选项样式 */
.bp-options, .likert-options { display: flex; flex-direction: column; gap: 12px; }

.bp-option { display: flex; align-items: center; gap: 16px; padding: 18px; background: #FFF; border: 2px solid #EEE; border-radius: 14px; cursor: pointer; transition: all 0.2s; }
.bp-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #DDD; flex-shrink: 0; position: relative; }
.bp-option.selected { border-color: var(--accent-orange); background: var(--accent-orange-soft); }
.bp-option.selected .bp-check { background: var(--accent-orange); border-color: var(--accent-orange); }
.bp-option.selected .bp-check::after { content: ''; position: absolute; top: 3px; left: 6px; width: 6px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.bp-text { font-size: 15px; color: #444; line-height: 1.5; }
.bp-option.selected .bp-text { font-weight: 700; color: #111; }

.likert-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #FFF; border: 1px solid #EEE; border-radius: 12px; cursor: pointer; }
.likert-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #DDD; flex-shrink: 0; }
.likert-option.selected { border-color: var(--accent-orange); background: var(--accent-orange-soft); }
.likert-option.selected .likert-dot { background: var(--accent-orange); border-color: var(--accent-orange); box-shadow: inset 0 0 0 3px white; }
.likert-text { font-size: 14px; color: #555; }
.likert-option.selected .likert-text { font-weight: 700; color: #111; }

.quiz-footer { padding: 20px; text-align: center; display: flex; justify-content: center; }
.footer-back-btn { background: transparent; border: 1px solid #DDD; color: #888; padding: 8px 24px; border-radius: 20px; font-size: 13px; }

/* ========== 结果页 ========== */
.result-page { padding: 20px; }
.result-container { max-width: 520px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }

.result-header-new { display: flex; align-items: center; justify-content: center; padding: 12px 0 20px; }
.result-header-title { text-align: center; }
.result-header-brand { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.result-header-subtitle { font-size: 13px; color: var(--text-sub); }

.result-type-card {
    background: var(--rainbow-light);
    border-radius: 18px;
    padding: 32px 20px;
    text-align: center;
    color: var(--text);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(107, 175, 146, 0.1);
}

.type-code { font-size: 48px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(255,255,255,0.8); color: var(--primary); }
.type-name { font-size: 16px; opacity: 0.9; margin-top: 4px; letter-spacing: 1px; color: var(--text-sub); font-weight: 600; }

.warning-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #C05621;
    border: 1px solid #FBD38D;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.section-card { background: white; padding: 20px; border-radius: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.section-title { font-size: 13px; font-weight: 700; color: #999; margin-bottom: 16px; }

.func-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.func-label { width: 28px; font-weight: 700; font-size: 12px; color: #555; text-align: right; }
.func-track { flex: 1; height: 10px; background: #F0F0F0; border-radius: 5px; overflow: hidden; }
.func-fill { height: 100%; border-radius: 5px; background: #A8D4E6; width: 0; transition: width 0.6s var(--ease); }
.func-fill.highlight { background: var(--rainbow); }
.func-value { width: 28px; font-size: 12px; font-weight: 600; color: #555; text-align: right; }

.trace-code { text-align: center; font-size: 10px; color: #CCC; margin: 10px 0; font-family: monospace; cursor: pointer; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.action-grid .btn { padding: 12px; font-size: 13px; }

/* ========== 详情页 ========== */
.detail-header { position: sticky; top: 0; background: #FFF; z-index: 10; padding: 15px 20px; display: flex; justify-content: space-between; border-bottom: 1px solid #EEE; }
.detail-back { color: var(--text-sub); font-size: 14px; font-weight: 600; cursor: pointer; }
.detail-save { color: var(--primary); font-size: 14px; font-weight: 700; cursor: pointer; }

.detail-content { padding: 24px 20px; max-width: 600px; margin: 0 auto; }
.detail-page-title { text-align: center; margin-bottom: 24px; }
.detail-page-brand { font-size: 15px; font-weight: 600; color: var(--primary); }
.detail-page-subtitle { font-size: 12px; color: #999; }

.detail-type-header { text-align: center; background: #F0F9F5; padding: 28px 20px; border-radius: 16px; margin-bottom: 28px; border: 1px solid #E1F0E9; }
.detail-type-code { font-size: 42px; font-weight: 800; color: var(--primary); letter-spacing: 2px; }
.detail-type-name { font-size: 16px; color: var(--primary-dark); font-weight: 500; margin-top: 6px; }

.detail-section { margin-bottom: 24px; }
.detail-section-title { font-size: 16px; font-weight: 700; color: #333; margin-bottom: 12px; padding: 8px 0 8px 12px; border-left: 4px solid var(--primary); border-bottom: 1px solid #f5f5f5; display: flex; align-items: center; }
.detail-section-content { font-size: 14px; line-height: 1.8; color: #555; text-align: justify; }
.detail-section-content p { margin-bottom: 8px; }
.detail-subtitle { font-weight: 700; color: #333; margin-right: 4px; }

/* ========== 图片预览模态框 ========== */
.image-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.image-modal img { max-width: 100%; max-height: 85vh; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.image-modal-close { position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; border-radius: 50%; background: #333; color: #FFF; border: none; font-size: 20px; cursor: pointer; }
.image-modal-tip { position: absolute; bottom: 30px; color: white; background: rgba(0,0,0,0.6); padding: 8px 16px; border-radius: 20px; font-size: 12px; }

@media (min-width: 768px) {
    .result-container, .detail-content { max-width: 600px; }
}