/* ========================================
   RAP-BTI — 说唱人格测试
   响应式适配: 移动端 + 桌面端
   ======================================== */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;

  --gold-primary: #d4a853;
  --gold-light: #f0d78c;
  --gold-dark: #a07d3a;

  --text-primary: #e8e6e3;
  --text-secondary: #9a9a9a;
  --text-muted: #666;

  --accent-red: #ff88e5;
  --accent-green: #daff84;
  --accent-blue: #8cf3ff;
  --accent-purple: #dca9f0;

  --border-color: #2a2a3e;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --font-display: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 页面切换 ---------- */
.page {
  display: none;
  width: 100%;
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.page.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* ========== 开场页 ========== */
#page-intro {
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1035 50%, #0d1117 100%);
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#page-intro::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(212, 168, 83, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(155, 89, 182, 0.04) 0%, transparent 50%);
  animation: bgFloat 15s ease-in-out infinite alternate;
}
@keyframes bgFloat {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-3%, 2%) rotate(2deg); }
}

.intro-container {
  text-align: center;
  padding: 40px 24px;
  position: relative;
  z-index:1;
  max-width: 560px;
  width: 100%;
}

.intro-logo {
  margin-bottom: 32px;
}
.logo-icon {
  font-size: 64px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(212, 168, 83, 0.5));
  animation: micBounce 2s ease-in-out infinite;
}
@keyframes micBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}
.logo-title {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  letter-spacing: 0.15em;
  margin-top: 4px;
}

.intro-desc {
  margin-bottom: 28px;
}
.intro-desc p {
  font-size: 15px;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.intro-features {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 36px;
}
.feature-tag {
  font-size: 13px;
  padding: 5px 14px;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-muted);
}

.btn-primary {
  display: inline-block;
  padding: 14px 56px;
  font-size: 18px;
  font-weight: 700;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  border: none;
  border-radius: 100px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3);
}
.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(212, 168, 83, 0.2);
}
.btn-pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3); }
  50% { box-shadow: 0 4px 35px rgba(212, 168, 83, 0.55); }
  100% { box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3); }
}

.btn-secondary {
  display: inline-block;
  padding: 12px 36px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-primary);
  background: transparent;
  border: 1.5px solid var(--gold-dark);
  border-radius: 100px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
}
.btn-secondary:active {
  background: rgba(212, 168, 83, 0.08);
}

.intro-disclaimer {
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ========== 答题页 ========== */
#page-quiz {
  background: var(--bg-primary);
  padding: 16px 0 24px;
  align-items: center;
  justify-content: flex-start;
}

.quiz-progress {
  display: flex;
  align-items: center;
  padding: 12px 20px 16px;
  gap: 12px;
  width: 100%;
  max-width: 560px;
}
.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-card);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-light));
  border-radius: 100px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}

.quiz-card-container {
  padding: 8px 20px;
  perspective: 1200px;
  width: 100%;
  max-width: 560px;
}

.quiz-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition: all 0.35s ease;
  opacity: 1;
  transform: translateX(0);
}
.quiz-card.slide-out-left {
  animation: slideOutLeft 0.35s forwards;
}
@keyframes slideOutLeft {
  to { opacity: 0; transform: translateX(-40%); }
}
.quiz-card.slide-in-right {
  animation: slideInRight 0.35s forwards;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40%); }
  to { opacity: 1; transform: translateX(0); }
}

.card-qnum {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-primary);
  background: rgba(212, 168, 83, 0.1);
  padding: 3px 12px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.card-question {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 22px;
  padding-left: 2px;
}

.card-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  text-align: left;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  word-break: break-word;
}
.option-btn:active {
  background: rgba(212, 168, 83, 0.12);
  border-color: var(--gold-dark);
  transform: scale(0.98);
}
.option-btn.selected {
  background: rgba(212, 168, 83, 0.12);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}
.option-label {
  font-weight: 700;
  color: var(--gold-primary);
  margin-right: 8px;
  font-size: 15px;
}

.quiz-tip {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0 0;
  font-style: italic;
}

/* 人格图片 */
.result-image-wrap {
  width: 100%;
  text-align: center;
  padding: 24px 0 0;
}
.result-image {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  object-fit: cover;
}

/* ========== 结果页 ========== */
#page-result {
  background: var(--bg-primary);
  padding-bottom: 40px;
  align-items: center;
}

.result-container {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 0;
}

.result-header {
  text-align: center;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}
.result-badge {
  display: inline-block;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  padding: 5px 18px;
  border-radius: 10px;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.result-artist {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.result-name {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.result-oneliner {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
}
.result-code {
  display: none;
}
.result-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tag-style, .tag-label {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 100px;
}
.tag-style {
  background: rgba(155, 89, 182, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(155, 89, 182, 0.25);
}
.tag-label {
  background: rgba(52, 152, 219, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(52, 152, 219, 0.2);
}

/* 雷达图区域 */
.result-radar-section {
  text-align: center;
  padding: 16px 0 8px;
}
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 12px;
  padding: 0 10px;
}
.radar-legend-item {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.radar-legend-item .dim-name {
  color: var(--gold-primary);
  font-weight: 700;
}
#radar-canvas {
  max-width: 100%;
  height: auto;
}

/* 描述文字 */
.result-desc {
  font-size: 14px;
  line-height: 1.8;
  color: #ffffff;
  padding: 16px 10px;
  text-align: justify;
}
.result-desc p {
  margin-bottom: 12px;
}

/* Verse 区域 */
.result-verse {
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.06), rgba(155, 89, 182, 0.04));
  border-left: 3px solid var(--gold-primary);
  padding: 16px 18px;
  border-radius: 0 12px 12px 0;
  margin: 20px 8px;
}
.verse-label {
  font-size: 13px;
  color: var(--gold-primary);
  font-weight: 700;
  margin-bottom: 8px;
}
.verse-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-display);
  font-weight: 500;
}
.verse-tags {
  margin-top: 12px;
}
.result-verse .result-tags {
  margin-top: 14px;
  justify-content: flex-start;
}

/* 信条 */
.result-motto {
  text-align: center;
  font-size: 36px;
  font-weight: 950;
  color: #ffffff;
  padding: 20px 14px;
  margin: 16px 0;
  letter-spacing: 0.02em;
  line-height: 1.3;
  border-top: 1px solid rgba(212, 168, 83, 0.15);
  border-bottom: 1px solid rgba(212, 168, 83, 0.15);
}

/* 关系区域 */
.result-relations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 8px 28px;
}
.relation-block {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 14px;
  border: 1px solid var(--border-color);
}
.relation-cp {
  border-top: 2px solid var(--accent-green);
}
.relation-beef {
  border-top: 2px solid var(--accent-red);
}
.relation-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.relation-cp .relation-title { color: var(--accent-green); }
.relation-beef .relation-title { color: var(--accent-red); }

.relation-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* 操作按钮 */
.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 14px 14px 28px;
  flex-wrap: wrap;
}

/* ========== 混合人格弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold-primary);
  margin-bottom: 14px;
}
.modal-desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

/* ========== 工具类 ========== */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* ========== 桌面端适配 (≥768px) ========== */
@media (min-width: 768px) {
  /* 开场页 */
  .intro-container {
    padding: 60px 40px;
    max-width: 640px;
  }
  .logo-icon { font-size: 80px; }
  .logo-title { font-size: 56px; }
  .logo-subtitle { font-size: 18px; }
  .intro-desc p { font-size: 16px; }
  .btn-primary {
    padding: 16px 64px;
    font-size: 18px;
  }
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 168, 83, 0.4);
  }
  .btn-secondary:hover {
    background: rgba(212, 168, 83, 0.08);
    transform: translateY(-1px);
  }

  /* 答题页 */
  #page-quiz {
    justify-content: center;
    padding-top: 32px;
  }
  .quiz-progress { max-width: 680px; }
  .quiz-card-container { max-width: 680px; }
  .quiz-card { padding: 36px 40px 36px; }
  .card-question { font-size: 19px; }
  .option-btn {
    padding: 16px 20px;
    font-size: 15px;
  }
  .option-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--gold-dark);
  }

  /* 结果页 — 宽屏单栏，最大宽度居中 */
  #page-result {
    padding-top: 40px;
    align-items: center;
  }
  .result-container {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 0 40px 48px;
    display: block;
  }

  .result-image {
    max-width: 490px;
  }

  .result-header {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding: 24px 0 20px;
    margin-bottom: 24px;
  }
  .result-artist { font-size: 26px; }
  .result-name { font-size: 42px; }
  .result-tags { justify-content: center; }

  .result-radar-section {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #radar-canvas {
    width: 300px;
    height: 300px;
  }

  .result-desc {
    padding: 16px 0 0;
  }
  .result-verse {
    margin: 16px 0;
  }
  .result-motto {
    text-align: center;
  }
  .result-relations {
    grid-template-columns: 1fr 1fr;
    margin: 28px 0 0;
  }
  .result-actions {
    justify-content: center;
  }
}

/* ========== 超宽屏适配 (≥1200px) ========== */
@media (min-width: 1200px) {
  .result-container {
    max-width: 760px;
    padding: 0 60px 60px;
  }
  .result-image {
    max-width: 560px;
  }
  #radar-canvas {
    width: 340px;
    height: 340px;
  }
  .result-artist { font-size: 28px; }
}

/* ========== 移动端通用适配 (<768px) ========== */
@media (max-width: 767px) {
  /* 答题页居中 */
  #page-quiz {
    align-items: center;
  }
  .quiz-progress,
  .quiz-card-container {
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 结果页：关系卡单栏 */
  .result-relations {
    grid-template-columns: 1fr;
    margin: 20px 8px 24px;
  }

  /* radar canvas 移动端缩小 */
  #radar-canvas {
    width: 260px;
    height: 260px;
  }

  /* 操作按钮纵向排列 */
  .result-actions {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  /* 按钮触摸友好 */
  .btn-primary,
  .btn-secondary {
    min-height: 48px;
  }
  .option-btn {
    min-height: 48px;
  }

  /* 结果页内边距收窄 */
  .result-container {
    padding: 16px 16px 0;
  }
}

/* ========== 小屏幕手机适配 (<375px) ========== */
@media (max-width: 374px) {
  .logo-title { font-size: 36px; }
  .logo-icon { font-size: 48px; }
  .card-question { font-size: 15px; }
  .option-btn {
    padding: 12px 14px;
    font-size: 14px;
  }
  .result-name { font-size: 28px; }
  .result-artist { font-size: 18px; }
}