/* =============================================
   MBTI 全局样式 - 移动端优先
   ============================================= */

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --secondary: #764ba2;
  --bg: #f0f2f8;
  --card: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(102,126,234,.15);
  --shadow-lg: 0 10px 40px rgba(102,126,234,.25);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

html { font-size: 16px; }

body {
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- 顶部 Header ---- */
.app-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 24px 20px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.app-header::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}
.app-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: 2px; }
.app-header p  { font-size: .85rem; opacity: .85; margin-top: 6px; }

/* ---- 进度条 ---- */
.progress-wrap {
  background: rgba(255,255,255,.25);
  border-radius: 10px;
  height: 6px;
  margin: 16px 0 4px;
  overflow: hidden;
}
.progress-bar {
  height: 6px;
  border-radius: 10px;
  background: white;
  transition: width .4s ease;
  width: 0%;
}
.progress-label { font-size: .75rem; opacity: .8; text-align: right; }

/* ---- 主内容区 ---- */
.main { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ---- 题目卡片 ---- */
.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color .2s;
}
.question-card.answered { border-color: var(--primary); }

.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.q-num {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.q-dim {
  font-size: .7rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 20px;
}
.q-text {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ---- 选项 ---- */
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
  font-size: .88rem;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}
.option:active { transform: scale(.98); }
.option .opt-label {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all .2s;
}
.option .opt-text { flex: 1; line-height: 1.5; padding-top: 2px; }

.option:hover {
  border-color: var(--primary);
  background: #f0f0ff;
}
.option.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(102,126,234,.1), rgba(118,75,162,.1));
}
.option.selected .opt-label {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  color: white;
}

/* ---- 提交按钮 ---- */
.submit-wrap { padding: 16px 0 32px; }
.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all .3s;
  letter-spacing: 1px;
}
.btn-submit:active { transform: scale(.97); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }

/* =============================================
   结果页样式
   ============================================= */
#result-page { display: none; }

.result-hero {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 36px 20px 28px;
  text-align: center;
}
.result-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.result-type  { font-size: 3rem; font-weight: 900; letter-spacing: 10px; margin-bottom: 4px; }
.result-name  { font-size: 1.2rem; font-weight: 600; opacity: .9; margin-bottom: 12px; }
.result-desc  { font-size: .88rem; opacity: .85; line-height: 1.7; max-width: 400px; margin: 0 auto; }

.result-main { padding: 16px; max-width: 600px; margin: 0 auto; }

.result-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 特点标签 */
.traits { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-tag {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
}

/* 职业网格 */
.careers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.career-item {
  padding: 10px 6px;
  background: var(--bg);
  border-radius: 10px;
  text-align: center;
  font-size: .8rem;
  color: var(--text);
  font-weight: 500;
}

/* 著名人物 */
.famous-list { list-style: none; }
.famous-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.famous-list li:last-child { border-bottom: none; }
.famous-list li::before { content: "⭐"; flex-shrink: 0; }

/* 维度得分 */
.scores-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
}
.score-dim { font-size: .75rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.score-bar-wrap { background: var(--border); border-radius: 6px; height: 8px; margin: 6px 0; overflow: hidden; }
.score-bar { height: 8px; border-radius: 6px; background: linear-gradient(135deg, var(--primary), var(--secondary)); transition: width .8s ease; }
.score-val { font-size: .85rem; font-weight: 700; color: var(--primary); }

/* 重测按钮 */
.btn-retry {
  width: 100%;
  padding: 15px;
  background: var(--card);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 50px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 32px;
  transition: all .2s;
}
.btn-retry:active { background: var(--primary); color: white; }

/* ---- 加载动画 ---- */
.loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading.show { display: flex; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 响应式 ---- */
@media (min-width: 480px) {
  .app-header h1 { font-size: 2rem; }
  .q-text { font-size: 1rem; }
  .option { font-size: .92rem; }
}
