:root {
  /* 古风墨色：宣纸 + 朱砂 + 黛青 */
  --bg-primary: #f4efe4;
  --bg-secondary: #ece4d2;
  --bg-card: #fffdf7;
  --text-primary: #2f2a26;
  --text-secondary: #6f6353;
  --text-light: #a99b85;
  --accent: #a63d2f;
  --accent-light: #d08a7d;
  --accent-soft: #eed9cf;
  --ink-green: #46605a;
  --ink-green-soft: #dce4dd;
  --gradient-warm: linear-gradient(135deg, #f4efe4 0%, #ece4d2 100%);
  --shadow-soft: 0 4px 24px rgba(47, 42, 38, 0.08);
  --shadow-card: 0 8px 32px rgba(47, 42, 38, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

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

html, body {
  min-height: 100vh;
  background: var(--gradient-warm);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 宣纸纹理感背景 */
.ink-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 85% 10%, rgba(166, 61, 47, 0.05), transparent),
    radial-gradient(ellipse 50% 35% at 10% 85%, rgba(70, 96, 90, 0.06), transparent);
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
}

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(166, 61, 47, 0.3);
}
.btn-primary:hover {
  background: #8f3327;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(166, 61, 47, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--text-light);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
}

/* ============ 开始页 ============ */
.hero {
  text-align: center;
  padding: 48px 0 28px;
}
.hero-seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: 0 6px 20px rgba(166, 61, 47, 0.35);
  transform: rotate(-4deg);
}
.hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 14px;
}
.hero h1 .accent { color: var(--accent); }
.hero .subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 2;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 36px;
}
.mini-tag {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-secondary);
  border-radius: 100px;
  font-size: 13px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-soft);
}

.privacy-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 28px;
  line-height: 1.6;
}

/* ============ 答题页 ============ */
.quiz-page { display: none; }
.quiz-page.show { display: block; }

.progress-wrap { padding: 16px 0 20px; }
.progress-text {
  font-size: 13px;
  color: var(--text-light);
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 10px;
}
.progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s ease;
}

.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-soft);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.question-card.switching {
  opacity: 0;
  transform: translateY(12px);
}
.question-text {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 22px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 15px 16px;
  background: var(--bg-primary);
  border: 1.5px solid var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.option-btn:hover {
  border-color: var(--accent-light);
  background: #fff;
}
.option-btn .letter {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s ease;
}
.option-btn.picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option-btn.picked .letter {
  background: var(--accent);
  color: #fff;
}

.prev-btn {
  display: block;
  margin: 20px auto 0;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 16px;
}
.prev-btn:hover { color: var(--text-secondary); }
.prev-btn:disabled { opacity: 0.3; cursor: default; }

/* ============ 结果页 ============ */
.result-page { display: none; }
.result-page.show { display: block; }

.result-header {
  text-align: center;
  padding: 32px 0 24px;
}
.result-cert {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--text-secondary);
  border: 1px solid var(--text-light);
  border-radius: 100px;
  padding: 6px 20px;
  margin-bottom: 18px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}
.tag {
  display: inline-block;
  padding: 8px 18px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.tag:nth-child(2) { background: #ece4d2; color: #7a6a4a; }
.tag:nth-child(3) { background: var(--ink-green-soft); color: var(--ink-green); }
.tag:nth-child(4) { background: #e4d8e0; color: #7a5570; }

.overall-comment {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.8;
  padding: 22px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
  text-align: center;
  position: relative;
}
.overall-comment::before {
  content: '"';
  position: absolute;
  top: 6px;
  left: 18px;
  font-size: 36px;
  color: var(--accent-light);
  font-family: Georgia, serif;
  line-height: 1;
}
.overall-comment::after {
  content: '"';
  position: absolute;
  bottom: -16px;
  right: 18px;
  font-size: 36px;
  color: var(--accent-light);
  font-family: Georgia, serif;
  line-height: 1;
}

/* 人物卡片 */
.person-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.person-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.person-label {
  font-size: 12px;
  color: var(--text-light);
  letter-spacing: 3px;
  margin-bottom: 16px;
}
.person-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.person-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}
.person-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}
.person-era {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.person-quote {
  font-size: 14px;
  color: var(--accent);
  font-style: italic;
  padding: 10px 14px;
  background: var(--bg-primary);
  border-left: 3px solid var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 14px;
  line-height: 1.7;
}
.person-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.9;
}
.person-tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--ink-green-soft);
  border-radius: var(--radius-md);
}
.person-tip .tip-icon { font-size: 18px; flex-shrink: 0; }
.person-tip .tip-text {
  font-size: 13px;
  color: #35503f;
  line-height: 1.7;
}

/* 雷达图 */
.radar-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 2px;
}
.radar-wrapper {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 1;
}
.radar-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 28px;
}

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  padding: 16px 0;
  line-height: 1.8;
}

/* ============ 揭榜 Loading ============ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 239, 228, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.loading-overlay.show { display: flex; }
.loading-seal {
  width: 72px;
  height: 72px;
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", serif;
  margin-bottom: 26px;
  animation: sealPulse 1.2s ease-in-out infinite;
}
@keyframes sealPulse {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(2deg) scale(1.06); }
}
.loading-text {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  letter-spacing: 1px;
}
.loading-text .dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ============ 分享弹窗 ============ */
.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 42, 38, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.share-modal.show { display: flex; }
.share-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.share-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
}
.share-preview {
  background: var(--gradient-warm);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  margin-bottom: 20px;
}
.share-preview .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.share-preview .tags .tag {
  font-size: 13px;
  padding: 4px 12px;
}
.share-preview .comment {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
}
.share-preview .brand {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 2px;
}
.share-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.share-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.share-option .icon { font-size: 24px; }
.close-share {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

/* ========== AI 深度分析 ========== */
#aiSection {
  margin: 24px 0;
}

.ai-loading {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}
.ai-spinner {
  font-size: 28px;
  animation: aiPulse 1.4s ease-in-out infinite;
}
@keyframes aiPulse {
  0%, 100% { transform: scale(1) rotate(-4deg); }
  50% { transform: scale(1.15) rotate(4deg); }
}

.ai-fallback {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

.ai-report {
  background: linear-gradient(135deg, #fffdf7 0%, #f8f2e6 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-soft);
  border-top: 4px solid var(--ink-green);
  animation: aiFadeIn 0.6s ease-out;
}
@keyframes aiFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-tagline {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.ai-analysis {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-indent: 2em;
}

.ai-tip {
  background: var(--ink-green);
  color: #fffdf7;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.7;
}
.ai-tip-icon {
  flex-shrink: 0;
  font-size: 18px;
}
