/* ================================================================
   emo 心理测评系统 - 全局样式
   ================================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f0f4f8;
  color: #2d3748;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* ---- Header ---- */
header {
  text-align: center;
  padding: 36px 20px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
  margin-bottom: 20px;
}
header h1 { font-size: 28px; margin-bottom: 6px; }
header p { opacity: .9; font-size: 14px; }
header .header-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 14px;
  flex-wrap: wrap;
}
header .header-stats span {
  font-size: 13px;
  opacity: .85;
  background: rgba(255,255,255,.15);
  padding: 4px 14px;
  border-radius: 20px;
}

/* ---- 搜索框 ---- */
.search-box {
  position: relative;
  margin-bottom: 16px;
}
.search-box input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  background: #fff;
}
.search-box input:focus { border-color: #667eea; }
.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  font-size: 16px;
}
.search-box .search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  cursor: pointer;
  font-size: 18px;
  display: none;
  background: none;
  border: none;
}

/* ---- 分类标签 ---- */
.cat-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cat-tab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #4a5568;
  transition: all .2s;
  white-space: nowrap;
}
.cat-tab:hover { border-color: #667eea; color: #667eea; }
.cat-tab.active { background: #667eea; color: #fff; border-color: #667eea; }

/* ---- 量表卡片网格 ---- */
.scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.scale-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.scale-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  border-color: #667eea;
}
a.scale-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.scale-card .card-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}
.badge-depression { background: #fed7d7; color: #9b2c2c; }
.badge-anxiety    { background: #fefcbf; color: #975a16; }
.badge-sleep      { background: #c6f6d5; color: #276749; }
.badge-personality{ background: #e9d8fd; color: #553c9a; }
.badge-ocd        { background: #bee3f8; color: #2a4365; }
.badge-other      { background: #e2e8f0; color: #4a5568; }
.scale-card h3 { font-size: 16px; margin-bottom: 6px; color: #2d3748; }
.scale-card .card-meta { font-size: 12px; color: #a0aec0; }
.scale-card .card-desc {
  font-size: 13px;
  color: #718096;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 面板区域 ---- */
.panel-wrap { display: none; }
.panel-wrap.active { display: block; }
.panel {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #667eea;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 600;
  background: none;
  border: none;
}
.back-btn:hover { opacity: .8; }

/* ---- 量表介绍 ---- */
.intro-section h2 { font-size: 22px; color: #4a5568; margin-bottom: 8px; }
.intro-section .subtitle { color: #718096; font-size: 14px; margin-bottom: 16px; }
.intro-section .desc {
  background: #f7fafc;
  border-left: 4px solid #667eea;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.info-card { background: #f7fafc; padding: 14px; border-radius: 10px; }
.info-card .label { font-size: 12px; color: #a0aec0; margin-bottom: 4px; }
.info-card .value { font-size: 14px; font-weight: 600; color: #4a5568; }
.scoring-info {
  background: #fffbeb;
  border: 1px solid #fbd38d;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #7c6e3c;
  line-height: 1.8;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-block;
  padding: 12px 32px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102,126,234,.4);
}
.btn-outline { background: #fff; color: #667eea; border: 2px solid #667eea; }
.btn-outline:hover { background: #667eea; color: #fff; }
.btn-baike {
  background: #eff6ff;
  color: #2563eb;
  border: 2px solid #bfdbfe;
  text-decoration: none;
}
.btn-baike:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.15);
}
.btn-sm { padding: 8px 20px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 答题区域 ---- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.quiz-progress { font-size: 14px; color: #718096; font-weight: 600; }
.quiz-progress span { color: #667eea; }
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  transition: width .3s;
}
.quiz-question {
  background: #f7fafc;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 16px;
}
.quiz-question .q-num {
  display: inline-block;
  background: #667eea;
  color: #fff;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.quiz-question .q-text {
  font-size: 16px;
  color: #2d3748;
  font-weight: 500;
  margin-bottom: 14px;
}
.options { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-btn {
  flex: 1;
  min-width: 90px;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  transition: all .2s;
  color: #4a5568;
}
.opt-btn:hover { border-color: #667eea; color: #667eea; }
.opt-btn.selected { background: #667eea; color: #fff; border-color: #667eea; }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 20px; gap: 12px; }
.page-question {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.page-question button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  transition: all .2s;
  color: #4a5568;
}
.page-question button:hover { border-color: #667eea; }
.page-question button.answered { background: #c6f6d5; border-color: #48bb78; }
.page-question button.current { background: #667eea; color: #fff; border-color: #667eea; }

/* ---- 结果区域 ---- */
.result-section { text-align: center; }
.result-score { font-size: 48px; font-weight: 700; color: #667eea; margin: 16px 0; }
.result-level {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding: 12px 24px;
  border-radius: 12px;
  display: inline-block;
}
.level-normal   { background: #c6f6d5; color: #276749; }
.level-mild     { background: #fefcbf; color: #975a16; }
.level-moderate { background: #fbd38d; color: #9c4221; }
.level-severe   { background: #fed7d7; color: #9b2c2c; }
.result-detail {
  text-align: left;
  background: #f7fafc;
  border-radius: 12px;
  padding: 24px;
  margin: 20px 0;
}
.result-detail h3 { margin-bottom: 12px; color: #4a5568; }
.result-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.result-detail td, .result-detail th {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.result-detail th { background: #edf2f7; font-weight: 600; color: #4a5568; }
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.factor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.factor-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
}
.factor-card .factor-name {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.factor-card .factor-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.factor-card .factor-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s;
}
.bar-green  { background: #48bb78; }
.bar-yellow { background: #ecc94b; }
.bar-orange { background: #ed8936; }
.bar-red    { background: #f56565; }

/* ---- 免责声明 ---- */
.disclaimer {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 10px;
  padding: 14px 20px;
  margin-top: 24px;
  font-size: 13px;
  color: #c53030;
  line-height: 1.8;
}

/* ---- 顶部警告横幅 ---- */
.warning-banner {
  background: #fffbeb;
  border: 1px solid #fbd38d;
  border-radius: 10px;
  padding: 12px 20px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #975a16;
  line-height: 1.8;
  text-align: center;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 32px 20px;
  color: #a0aec0;
  font-size: 13px;
}

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #a0aec0;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ---- 保存进度提示 ---- */
.save-hint {
  text-align: center;
  font-size: 12px;
  color: #a0aec0;
  margin-top: 10px;
}

/* ================================================================
   响应式 - 手机端
   ================================================================ */
@media (max-width: 640px) {
  .container { padding: 0; }
  header { padding: 24px 16px 20px; border-radius: 0 0 16px 16px; margin-bottom: 12px; }
  header h1 { font-size: 20px; }
  header .header-stats { gap: 8px; }
  header .header-stats span { font-size: 11px; padding: 3px 10px; }
  .search-box { margin: 0 8px 12px; }
  .cat-tabs { padding: 0 8px; gap: 4px; }
  .cat-tab { font-size: 11px; padding: 5px 12px; }
  .scale-grid { grid-template-columns: 1fr; gap: 10px; padding: 0 8px; }
  .scale-card { padding: 16px; }
  .panel { margin: 0 8px; padding: 18px; border-radius: 12px; }
  .intro-section h2 { font-size: 18px; }
  .intro-section .desc { padding: 12px 14px; font-size: 13px; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .info-card { padding: 10px 12px; }
  .info-card .value { font-size: 13px; }
  .scoring-info { padding: 12px 14px; font-size: 12px; }
  .btn { width: 100%; text-align: center; padding: 12px 20px; font-size: 14px; }
  .btn-sm { width: auto; padding: 8px 14px; }
  .quiz-question { padding: 14px 12px; margin-bottom: 10px; }
  .quiz-question .q-text { font-size: 15px; }
  .options { flex-direction: column; gap: 6px; }
  .opt-btn { font-size: 13px; padding: 12px 14px; text-align: left; min-width: auto; }
  .result-score { font-size: 36px; }
  .result-level { font-size: 16px; padding: 10px 18px; }
  .result-detail { padding: 14px; margin: 16px 0; overflow-x: auto; }
  .result-detail table { font-size: 11px; }
  .result-detail td, .result-detail th { padding: 6px 8px; }
  .result-actions { flex-direction: column; }
  .factor-grid { grid-template-columns: 1fr; }
  .page-question button { width: 28px; height: 28px; font-size: 11px; }
  footer { padding: 24px 16px; font-size: 12px; }
}

@media (max-width: 380px) {
  .cat-tab { font-size: 10px; padding: 4px 8px; }
  .info-grid { grid-template-columns: 1fr; }
}
