/* ============================================
   「灵犀人格图谱」测试系统样式 v2.0
   ============================================ */

/* ========== CSS Variables ========== */
:root {
    --primary: #2D3561;
    --primary-light: #4A6FA5;
    --primary-dark: #1a2040;
    --accent: #C9A959;
    --accent-light: #dfc77a;
    --bg-main: #FAF6F0;
    --bg-card: #FFFFFF;
    --bg-secondary: #E8E4F0;
    --bg-gradient: linear-gradient(135deg, #f5f0e8 0%, #e8e4f0 50%, #d4e5f7 100%);
    --text-primary: #2C3E50;
    --text-secondary: #6B7B8C;
    --text-muted: #9CA3AF;
    --success: #4CAF50;
    --error: #E57373;
    --shadow-sm: 0 2px 8px rgba(45, 53, 97, 0.08);
    --shadow-md: 0 4px 20px rgba(45, 53, 97, 0.12);
    --shadow-lg: 0 8px 40px rgba(45, 53, 97, 0.16);
    --shadow-glow: 0 0 30px rgba(201, 169, 89, 0.3);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== Reset ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--primary); }
p { margin-bottom: 0.75rem; }
a { color: var(--primary-light); text-decoration: none; }

/* ========== Container ========== */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-narrow { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 20px; }

/* ========== Background ========== */
.app-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; background: var(--bg-gradient); }
.bg-decoration { position: absolute; border-radius: 50%; opacity: 0.3; filter: blur(80px); }
.bg-decoration-1 { width: 400px; height: 400px; background: rgba(201, 169, 89, 0.2); top: -100px; right: -100px; animation: float 8s ease-in-out infinite; }
.bg-decoration-2 { width: 300px; height: 300px; background: rgba(74, 111, 165, 0.2); bottom: -50px; left: -50px; animation: float 10s ease-in-out infinite reverse; }
.bg-decoration-3 { width: 200px; height: 200px; background: rgba(45, 53, 97, 0.15); top: 50%; left: 50%; transform: translate(-50%, -50%); animation: pulse 6s ease-in-out infinite; }

@keyframes float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-30px) rotate(5deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); } 50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.1); } }

/* ========== Header ========== */
.header { padding: 16px 0; position: relative; z-index: 10; }
.header-content { display: flex; align-items: center; justify-content: center; gap: 12px; }
.logo-icon { width: 40px; height: 40px; }
.logo-text { font-size: 1.25rem; font-weight: 600; color: var(--primary); }

/* ========== Pages ========== */
.page { display: none; opacity: 0; transform: translateY(20px); transition: opacity var(--transition-slow), transform var(--transition-slow); }
.page.active { display: block; opacity: 1; transform: translateY(0); }

/* ========== Home Page ========== */
.home-page { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; padding: 20px 0; width: 100%; }
.home-content { text-align: center; max-width: 600px; width: 100%; margin: 0 auto; }
.hero-icon { margin-bottom: 32px; animation: fadeInUp 0.8s ease; }
.hero-icon svg { width: 120px; height: 120px; }
.hero-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 16px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: fadeInUp 0.8s ease 0.1s both; }
.hero-subtitle { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.8; animation: fadeInUp 0.8s ease 0.2s both; }

.hero-features { display: flex; justify-content: center; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; animation: fadeInUp 0.8s ease 0.3s both; }
.feature-tag { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--bg-card); border-radius: var(--radius-full); box-shadow: var(--shadow-sm); font-size: 0.875rem; color: var(--text-secondary); }
.feature-tag svg { width: 16px; height: 16px; color: var(--accent); }

.home-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 24px; animation: fadeInUp 0.8s ease 0.4s both; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* ========== Buttons ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 32px; font-size: 1rem; font-weight: 600; border: none; border-radius: var(--radius-full); cursor: pointer; transition: all var(--transition-normal); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: white; box-shadow: var(--shadow-md), var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--shadow-glow); }
.btn-secondary { background: var(--bg-card); color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 10px 20px; font-size: 0.9rem; }
.btn-ghost:hover { color: var(--primary); }
.btn-icon { width: 18px; height: 18px; }
.btn-lg { padding: 18px 40px; font-size: 1.125rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ========== Quiz Page ========== */
.quiz-page { min-height: calc(100vh - 80px); padding: 20px 0; display: flex; align-items: center; justify-content: center; }
.quiz-header { margin-bottom: 32px; }
.progress-container { margin-bottom: 16px; }
.progress-bar { height: 6px; background: var(--bg-secondary); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%); border-radius: var(--radius-full); transition: width var(--transition-normal); }
.progress-text { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin-top: 8px; }
.dimension-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg-secondary); border-radius: var(--radius-full); font-size: 0.8125rem; color: var(--primary); margin-bottom: 20px; }

/* ========== Question Card ========== */
.question-card { background: var(--bg-card); border-radius: var(--radius-xl); padding: 40px; box-shadow: var(--shadow-md); margin-bottom: 32px; }
.question-number { font-size: 0.875rem; color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.question-text { font-size: 1.375rem; font-weight: 600; color: var(--primary); line-height: 1.6; margin-bottom: 32px; }

/* ========== Options ========== */
.options-list { display: flex; flex-direction: column; gap: 14px; }
.option-item { position: relative; padding: 18px 22px; background: var(--bg-main); border: 2px solid transparent; border-radius: var(--radius-lg); cursor: pointer; transition: all var(--transition-normal); display: flex; align-items: flex-start; gap: 14px; }
.option-item:hover { background: var(--bg-secondary); border-color: var(--primary-light); transform: translateX(8px); }
.option-item.selected { background: linear-gradient(135deg, rgba(45, 53, 97, 0.08) 0%, rgba(74, 111, 165, 0.08) 100%); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.option-marker { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; background: var(--bg-card); border: 2px solid var(--primary-light); border-radius: 50%; font-size: 0.875rem; font-weight: 600; color: var(--primary); transition: all var(--transition-normal); flex-shrink: 0; }
.option-item.selected .option-marker { background: var(--primary); border-color: var(--primary); color: white; }
.option-text { flex: 1; font-size: 1rem; color: var(--text-primary); line-height: 1.6; }

/* ========== Navigation ========== */
.quiz-nav { display: flex; justify-content: space-between; gap: 16px; }
.nav-btn { flex: 1; max-width: 200px; }
.nav-btn-prev { background: var(--bg-card); color: var(--text-secondary); border: 2px solid var(--bg-secondary); }
.nav-btn-prev:hover { border-color: var(--primary-light); color: var(--primary); }

/* ========== Result Page ========== */
.result-page { padding: 20px 0; display: flex; align-items: center; justify-content: center; }
.result-card { background: var(--bg-card); border-radius: var(--radius-xl); padding: 48px 40px; box-shadow: var(--shadow-lg); text-align: center; margin-bottom: 32px; }
.result-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: white; border-radius: var(--radius-full); font-size: 0.875rem; font-weight: 600; margin-bottom: 24px; }
.result-icon { margin-bottom: 24px; }
.result-icon svg { width: 80px; height: 80px; }
.result-title { font-size: 2rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; line-height: 1.4; }
.result-tag { display: inline-block; padding: 12px 28px; background: linear-gradient(135deg, var(--bg-secondary) 0%, #f0eef5 100%); border-radius: var(--radius-lg); font-size: 1.125rem; color: var(--primary); margin-bottom: 28px; }
.result-summary { font-size: 1.0625rem; color: var(--text-primary); line-height: 1.9; text-align: left; padding: 24px; background: var(--bg-main); border-radius: var(--radius-lg); margin-bottom: 24px; }

/* ========== Trait Section ========== */
.trait-section { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.trait-item { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--bg-secondary); }
.trait-item:last-child { border-bottom: none; padding-bottom: 0; }
.trait-item:first-child { padding-top: 0; }
.trait-label { font-size: 0.875rem; font-weight: 600; color: var(--primary); }
.trait-text { font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.6; }

/* ========== Dimension Grid ========== */
.dimension-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 32px; }
.dimension-item { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.dimension-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); border-radius: var(--radius-sm); flex-shrink: 0; }
.dimension-icon svg { width: 20px; height: 20px; color: var(--accent); }
.dimension-info { flex: 1; text-align: left; }
.dimension-name { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.dimension-value { font-size: 0.9375rem; font-weight: 600; color: var(--primary); }
.dimension-value.type-a { color: var(--primary); }
.dimension-value.type-b { color: var(--text-secondary); }

/* ========== Scenario Section ========== */
.scenario-section { margin-bottom: 32px; }
.scenario-title { font-size: 1.125rem; font-weight: 600; color: var(--primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.scenario-title svg { width: 20px; height: 20px; color: var(--accent); }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.scenario-card { padding: 20px; background: var(--bg-card); border-radius: var(--radius-md); text-align: left; box-shadow: var(--shadow-sm); }
.scenario-card-title { font-size: 0.9375rem; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
.scenario-card-text { font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.7; }

/* ========== Tips Card ========== */
.tips-card { padding: 24px; background: linear-gradient(135deg, rgba(201, 169, 89, 0.12) 0%, rgba(201, 169, 89, 0.05) 100%); border: 1px solid rgba(201, 169, 89, 0.3); border-radius: var(--radius-lg); margin-bottom: 32px; text-align: center; }
.tips-title { font-size: 0.9375rem; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.tips-text { font-size: 1rem; color: var(--text-primary); line-height: 1.7; margin: 0; }

/* ========== Result Actions ========== */
.result-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.share-btn { background: var(--bg-card); color: var(--primary); border: 2px solid var(--primary); }
.share-btn:hover { background: var(--primary); color: white; }

/* ========== Gallery Page ========== */
.gallery-page { padding: 20px 0; display: flex; flex-direction: column; align-items: center; min-height: calc(100vh - 80px); }
.gallery-header { text-align: center; margin-bottom: 40px; }
.gallery-title { font-size: 2rem; margin-bottom: 8px; }
.gallery-subtitle { color: var(--text-secondary); font-size: 1rem; }
.gallery-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; margin-bottom: 40px; }
.gallery-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-md); transition: all var(--transition-normal); cursor: pointer; border: 2px solid transparent; }
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.gallery-card.expanded { border-color: var(--accent); box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent); }
.gallery-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.gallery-type { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.gallery-expand-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); border-radius: 50%; flex-shrink: 0; transition: transform var(--transition-normal), background var(--transition-normal); }
.gallery-expand-icon svg { width: 14px; height: 14px; color: var(--primary); }
.gallery-card.expanded .gallery-expand-icon { transform: rotate(180deg); background: var(--accent); }
.gallery-card.expanded .gallery-expand-icon svg { color: white; }
.gallery-card-tag { font-size: 0.9375rem; color: var(--text-secondary); margin-bottom: 12px; padding: 6px 12px; background: var(--bg-secondary); border-radius: var(--radius-sm); display: inline-block; }
.gallery-card-summary { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.gallery-card-core { font-size: 0.8125rem; color: var(--text-muted); }
/* 展开区域 */
.gallery-card-detail { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bg-secondary); }
.gallery-card.expanded .gallery-card-detail { display: block; }
.gallery-detail-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--bg-secondary); }
.gallery-detail-item:last-child { border-bottom: none; padding-bottom: 0; }
.gallery-detail-label { font-size: 0.8125rem; font-weight: 600; color: var(--primary); }
.gallery-detail-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }
.gallery-footer { text-align: center; margin-top: 32px; }

/* ========== Toast ========== */
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(100px); padding: 14px 28px; background: var(--primary); color: white; border-radius: var(--radius-full); font-size: 0.9375rem; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transition: all var(--transition-normal); z-index: 1000; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========== Loading ========== */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(250, 246, 240, 0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity var(--transition-normal); }
.loading-overlay.show { opacity: 1; pointer-events: all; }
.loading-spinner { width: 48px; height: 48px; border: 4px solid var(--bg-secondary); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 1rem; color: var(--text-secondary); }

/* ========== Footer ========== */
.footer { text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.75rem; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .hero-title { font-size: 1.75rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-features { flex-direction: column; align-items: center; }
    .question-card { padding: 28px 20px; }
    .question-text { font-size: 1.125rem; }
    .option-item { padding: 14px 16px; }
    .result-card { padding: 32px 20px; }
    .result-title { font-size: 1.5rem; }
    .quiz-nav { flex-direction: column; }
    .nav-btn { max-width: none; }
    .result-actions { flex-direction: column; }
    .btn { width: 100%; }
    .gallery-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    .container { padding: 0 16px; }
    .btn-lg { padding: 14px 28px; font-size: 1rem; }
    .dimension-grid { grid-template-columns: 1fr 1fr; }
}
