/* ===== 全局变量 ===== */
:root {
  --color-primary: #D4726A;
  --color-primary-light: #E8A09A;
  --color-primary-dark: #B85A53;
  --color-secondary: #F5E6D3;
  --color-secondary-light: #FBF3EA;
  --color-accent: #2D3436;
  --color-accent-light: #636E72;
  --color-bg: #FFFAF5;
  --color-white: #FFFFFF;
  --color-danger: #E17055;
  --color-warning: #FDCB6E;
  --color-success: #00B894;
  --color-info: #74B9FF;

  --font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: all 0.3s ease;
}

/* ===== 重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-accent);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* ===== 布局容器 ===== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 24px 0;
}

/* ===== 首页 ===== */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--color-accent-light);
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-secondary);
  border-radius: var(--radius-sm);
}

.feature-text {
  font-size: 14px;
  line-height: 1.5;
}

.feature-text strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(212, 114, 106, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 6px 16px rgba(212, 114, 106, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-secondary-light);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 14px;
  width: auto;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== 答题页面 ===== */
.quiz-header {
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 10;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--color-accent-light);
  text-align: center;
}

/* 题目卡片 */
.question-card {
  animation: fadeInUp 0.4s ease;
}

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

.question-dimension {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-secondary);
  color: var(--color-primary-dark);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--color-accent);
}

/* 选项 */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--color-white);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.option-item:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.option-item.selected {
  border-color: var(--color-primary);
  background: var(--color-secondary-light);
  box-shadow: var(--shadow-md);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent-light);
  flex-shrink: 0;
  transition: var(--transition);
}

.option-item.selected .option-letter {
  background: var(--color-primary);
  color: var(--color-white);
}

.option-text {
  font-size: 15px;
  line-height: 1.5;
  padding-top: 2px;
}

/* 文本框 */
.text-input-area {
  margin-top: 20px;
  margin-bottom: 24px;
}

.text-input-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-accent-light);
  cursor: pointer;
  margin-bottom: 8px;
  user-select: none;
}

.text-input-toggle:hover {
  color: var(--color-primary);
}

.text-input-area textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-family);
  line-height: 1.5;
  resize: vertical;
  transition: var(--transition);
  background: var(--color-white);
  color: var(--color-accent);
}

.text-input-area textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(212, 114, 106, 0.1);
}

.text-input-area textarea::placeholder {
  color: #B2BEC3;
}

/* 答题底部导航 */
.quiz-nav {
  display: flex;
  gap: 12px;
  padding: 20px 0 32px;
}

.quiz-nav .btn {
  flex: 1;
}

/* ===== 报告页面 ===== */
.report-section {
  margin-bottom: 32px;
}

.report-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.report-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-accent);
}

/* 画像卡片 */
.profile-card {
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-xl);
  color: var(--color-white);
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(212, 114, 106, 0.3);
}

.profile-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-tagline {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.5;
}

.profile-desc {
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.85;
  text-align: left;
}

/* 雷达图 */
.radar-chart-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* 维度解读 */
.dimension-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-secondary);
}

.dimension-item:last-child {
  border-bottom: none;
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dimension-name {
  font-size: 15px;
  font-weight: 600;
}

.dimension-score {
  font-size: 14px;
  color: var(--color-primary);
  font-weight: 600;
}

.dimension-bar {
  width: 100%;
  height: 8px;
  background: var(--color-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.dimension-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}

.dimension-bar-fill.low { background: var(--color-info); }
.dimension-bar-fill.mid { background: var(--color-warning); }
.dimension-bar-fill.high { background: var(--color-success); }

.dimension-interpretation {
  font-size: 13px;
  color: var(--color-accent-light);
  line-height: 1.5;
}

.dimension-adjustment {
  font-size: 12px;
  color: var(--color-primary);
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--color-secondary-light);
  border-radius: 4px;
  display: inline-block;
}

/* AI洞察 */
.ai-insight-card {
  background: linear-gradient(135deg, #FFF5F5, #FFF0ED);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px;
  margin-bottom: 12px;
}

.ai-insight-card h4 {
  font-size: 15px;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.ai-insight-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-accent);
}

.contradiction-item {
  padding: 12px;
  background: #FFF9E6;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
  color: #856404;
}

/* 优势/风险/防备/行动 */
.strength-item, .risk-item, .action-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-secondary-light);
}

.strength-item:last-child, .risk-item:last-child, .action-item:last-child {
  border-bottom: none;
}

.item-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.item-text {
  font-size: 14px;
  line-height: 1.6;
}

/* 防备手册 */
.defense-card {
  background: var(--color-white);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
}

.defense-scenario {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-accent);
}

.defense-tactic {
  font-size: 13px;
  color: var(--color-danger);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #FFF0ED;
  border-radius: var(--radius-sm);
}

.defense-response {
  font-size: 14px;
  color: var(--color-success);
  padding: 6px 10px;
  background: #E6FFF9;
  border-radius: var(--radius-sm);
}

/* 分享 */
.share-section {
  text-align: center;
  padding: 24px 0;
}

.share-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--color-secondary-light);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--color-accent-light);
  word-break: break-all;
  margin-bottom: 12px;
}

/* ===== 管理员页面 ===== */
.admin-login {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
}

.admin-login h2 {
  margin-bottom: 24px;
}

.admin-login input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: var(--font-family);
  margin-bottom: 16px;
  text-align: center;
}

.admin-login input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.record-table th,
.record-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--color-secondary);
}

.record-table th {
  font-weight: 600;
  color: var(--color-accent-light);
  font-size: 12px;
  text-transform: uppercase;
}

.record-table tr:hover {
  background: var(--color-secondary-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-white);
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--color-accent-light);
  margin-top: 4px;
}

/* ===== 加载状态 ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-secondary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: var(--color-accent-light);
}

/* ===== 知情同意弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 16px;
  text-align: center;
}

.modal p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-accent-light);
  margin-bottom: 20px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-buttons .btn {
  flex: 1;
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
  .container {
    max-width: 520px;
  }

  .hero-title {
    font-size: 32px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-muted { color: var(--color-accent-light); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ===== 管理员详情面板 ===== */
.detail-panel {
  padding: 20px 24px;
  background: #fafafa;
  border-top: 2px solid var(--color-primary);
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.detail-scores-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.detail-score-item {
  background: white;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.detail-score-item .dim-name {
  font-weight: 600;
  color: var(--color-accent);
  display: block;
  margin-bottom: 2px;
}

.detail-score-item .dim-raw,
.detail-score-item .dim-adj {
  display: block;
  color: #666;
  font-size: 11px;
}

.detail-dim-group {
  margin-bottom: 12px;
}

.detail-dim-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
  padding: 2px 8px;
  background: rgba(212, 114, 106, 0.1);
  border-radius: 4px;
  display: inline-block;
}

.detail-answer-item {
  padding: 6px 10px;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.6;
}

.detail-answer-item:last-child {
  border-bottom: none;
}

.detail-answer-item .q-id {
  display: inline-block;
  min-width: 32px;
  font-weight: 600;
  color: var(--color-accent);
}

.detail-answer-item .q-text {
  color: #444;
}

.detail-answer-item .q-choice {
  color: var(--color-primary-dark);
  margin-left: 4px;
}

.detail-text-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.detail-text-item .q-id {
  font-weight: 600;
  color: var(--color-accent);
  margin-right: 4px;
}

.detail-text-item .q-text {
  color: #666;
  font-size: 11px;
  display: block;
  margin-bottom: 4px;
}

.detail-text-item .text-content {
  background: #f5f5f5;
  padding: 8px 10px;
  border-radius: 4px;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.ai-section {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.ai-section ul {
  padding-left: 18px;
  margin: 4px 0;
}

.ai-section li {
  margin-bottom: 3px;
  font-size: 12px;
}

.defense-mini {
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  line-height: 1.6;
}

.defense-mini div {
  margin-bottom: 2px;
}

@media (max-width: 640px) {
  .detail-scores-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
