@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a1a;
  --card: rgba(255,255,255,0.05);
  --card-hover: rgba(255,255,255,0.1);
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --accent3: #fd79a8;
  --text: #e0e0e0;
  --text-dim: #888;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --info: #74b9ff;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景粒子效果 */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 开始界面 */
.screen { display: none; width: 100%; }
.screen.active { display: flex; flex-direction: column; align-items: center; }

.title {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  text-align: center;
  animation: fadeInUp 0.8s ease;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 40px;
  text-align: center;
  animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes barFill {
  from { width: 0; }
}

/* 开始按钮 */
.btn-start {
  padding: 16px 60px;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  animation: pulse 2s infinite;
  font-family: inherit;
}

.btn-start:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(108,92,231,0.5);
}

/* 性别选择 */
.gender-select {
  display: flex;
  gap: 30px;
  margin: 30px 0;
}

.gender-card {
  width: 160px;
  height: 200px;
  border-radius: 20px;
  background: var(--card);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.gender-card:hover {
  background: var(--card-hover);
  transform: translateY(-5px);
}

.gender-card.selected {
  border-color: var(--accent);
  background: rgba(108,92,231,0.15);
  box-shadow: 0 0 20px rgba(108,92,231,0.3);
}

.gender-icon { font-size: 4rem; }
.gender-label { font-size: 1.1rem; font-weight: 500; }

/* 游戏主界面 */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: var(--card);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.age-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent2);
}

.stage-label {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* 属性条 */
.stats-panel {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 10px;
}

.stat-icon { font-size: 1.2rem; width: 24px; text-align: center; }

.stat-info { flex: 1; }

.stat-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.stat-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
  animation: barFill 0.8s ease;
}

.stat-value {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 28px;
  text-align: right;
}

/* 事件卡片 */
.event-card {
  width: 100%;
  background: var(--card);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.05);
  animation: fadeInUp 0.5s ease;
}

.event-year {
  font-size: 0.85rem;
  color: var(--accent2);
  margin-bottom: 8px;
}

.event-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}

.event-desc {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 25px;
}

/* 选择按钮 */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.choice-btn:hover {
  background: rgba(108,92,231,0.15);
  border-color: var(--accent);
  transform: translateX(5px);
}

.choice-btn .choice-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.choice-btn .choice-text { flex: 1; }

.choice-btn .choice-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* 结果提示 */
.result-toast {
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 15px;
  animation: fadeIn 0.5s ease;
  display: none;
}

.result-toast.show { display: block; }

.result-toast.positive {
  background: rgba(0,184,148,0.1);
  border: 1px solid rgba(0,184,148,0.3);
}

.result-toast.negative {
  background: rgba(225,112,85,0.1);
  border: 1px solid rgba(225,112,85,0.3);
}

.result-toast.neutral {
  background: rgba(116,185,255,0.1);
  border: 1px solid rgba(116,185,255,0.3);
}

.result-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.result-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.stat-change {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin: 2px;
}

.stat-change.up {
  color: var(--success);
  background: rgba(0,184,148,0.15);
}

.stat-change.down {
  color: var(--danger);
  background: rgba(225,112,85,0.15);
}

/* 继续按钮 */
.btn-continue {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(108,92,231,0.4);
}

/* ===== 结局界面 ===== */
.end-container {
  width: 100%;
  animation: fadeInUp 0.8s ease;
}

.end-header {
  text-align: center;
  margin-bottom: 30px;
}

.end-header .title { font-size: 2.2rem; margin-bottom: 5px; }

.end-subtitle {
  color: var(--text-dim);
  font-size: 1rem;
}

/* MBTI 卡片 */
.mbti-card {
  width: 100%;
  padding: 30px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(108,92,231,0.2), rgba(253,121,168,0.2));
  border: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
}

.mbti-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(108,92,231,0.1), transparent, rgba(253,121,168,0.1), transparent);
  animation: rotate 10s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.mbti-type {
  position: relative;
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe, #fd79a8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.mbti-name {
  position: relative;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 8px;
}

.mbti-desc {
  position: relative;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.mbti-tagline {
  position: relative;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent3);
  margin-bottom: 8px;
  font-style: italic;
}

/* MBTI 深度解读卡片 */
.mbti-detail-card {
  width: 100%;
  padding: 25px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 25px;
}

.mbti-detail-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  text-align: center;
  color: var(--accent2);
}

.mbti-detail-section {
  margin-bottom: 16px;
}

.mbti-detail-section:last-child {
  margin-bottom: 0;
}

.mbti-detail-label {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.mbti-detail-text {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.8;
}

.mbti-detail-row {
  display: flex;
  gap: 20px;
}

.mbti-detail-half {
  flex: 1;
}

.mbti-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mbti-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.mbti-tag.strength {
  background: rgba(0,184,148,0.12);
  color: #55efc4;
  border: 1px solid rgba(0,184,148,0.25);
}

.mbti-tag.weakness {
  background: rgba(225,112,85,0.12);
  color: #fab1a0;
  border: 1px solid rgba(225,112,85,0.25);
}

/* ===== SBTI 隐藏人格卡片 ===== */
.sbti-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fd79a8, #6c5ce7);
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 1px;
  animation: sbtiGlow 2s ease-in-out infinite alternate;
}

@keyframes sbtiGlow {
  from { box-shadow: 0 0 8px rgba(253,121,168,0.3); }
  to   { box-shadow: 0 0 20px rgba(108,92,231,0.5), 0 0 40px rgba(253,121,168,0.2); }
}

.mbti-card.sbti-card {
  border: 2px solid var(--sbti-color, #a29bfe);
  box-shadow: 0 0 30px rgba(108,92,231,0.2),
              inset 0 0 30px rgba(108,92,231,0.05);
  animation: sbtiCardPulse 3s ease-in-out infinite;
}

@keyframes sbtiCardPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(108,92,231,0.2), inset 0 0 30px rgba(108,92,231,0.05); }
  50%      { box-shadow: 0 0 50px rgba(108,92,231,0.35), inset 0 0 40px rgba(108,92,231,0.08); }
}

.mbti-card.sbti-card .mbti-type {
  background: linear-gradient(135deg, var(--sbti-color, #a29bfe), #e84393);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mbti-card.sbti-card .mbti-name {
  color: var(--sbti-color, #a29bfe);
}

.mbti-base-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  opacity: 0.6;
  font-style: italic;
}

.mbti-detail-card.sbti-detail {
  border: 1px solid var(--sbti-color, #a29bfe);
  box-shadow: 0 0 20px color-mix(in srgb, var(--sbti-color, #a29bfe) 15%, transparent);
}

.mbti-detail-card.sbti-detail .mbti-detail-title {
  color: var(--sbti-color, #a29bfe);
}

/* MBTI 维度分析 */
.mbti-dimensions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 25px;
}

.dimension-item {
  padding: 15px;
  border-radius: 12px;
  background: var(--card);
}

.dimension-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.dimension-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.dimension-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}

.dimension-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
}

/* 人生时间线 */
.timeline {
  width: 100%;
  margin-bottom: 25px;
}

.timeline-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
  text-align: center;
}

.timeline-items {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

.timeline-items::-webkit-scrollbar {
  width: 4px;
}

.timeline-items::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
}

.timeline-items::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: slideIn 0.3s ease;
}

.timeline-age {
  min-width: 45px;
  font-weight: 700;
  color: var(--accent2);
  font-size: 0.9rem;
}

.timeline-event {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* 最终属性 */
.final-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 25px;
}

.final-stat {
  padding: 15px;
  border-radius: 12px;
  background: var(--card);
  text-align: center;
}

.final-stat-icon { font-size: 1.5rem; margin-bottom: 5px; }

.final-stat-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.final-stat-value {
  font-size: 1.5rem;
  font-weight: 900;
}

/* 人生评价 */
.life-comment {
  width: 100%;
  padding: 20px;
  border-radius: 15px;
  background: var(--card);
  margin-bottom: 20px;
  text-align: center;
}

.life-comment-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent2);
}

.life-comment-text {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.btn-restart {
  padding: 14px 50px;
  border: 2px solid var(--accent);
  border-radius: 50px;
  background: transparent;
  color: var(--accent2);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s;
}

.btn-restart:hover {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 20px rgba(108,92,231,0.4);
}

/* 出身卡片 */
.origin-card {
  width: 100%;
  padding: 25px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 25px;
  text-align: center;
  animation: fadeInUp 0.6s ease;
}

.origin-icon { font-size: 3rem; margin-bottom: 10px; }

.origin-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 8px;
}

.origin-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 15px;
}

.origin-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.origin-stat-tag {
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
}

/* 随机事件特殊样式 */
.event-card.random-event {
  border: 1px solid rgba(253,121,168,0.3);
  background: linear-gradient(135deg, rgba(253,121,168,0.08), rgba(108,92,231,0.08));
}

.random-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent3), var(--accent));
  color: white;
  margin-bottom: 8px;
}

/* 响应式 */
@media (max-width: 600px) {
  .title { font-size: 2rem; }
  .stats-panel { grid-template-columns: 1fr; }
  .gender-card { width: 120px; height: 160px; }
  .gender-icon { font-size: 3rem; }
  .mbti-type { font-size: 3rem; }
  .final-stats { grid-template-columns: repeat(2, 1fr); }
  .mbti-dimensions { grid-template-columns: 1fr; }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .mbti-detail-row { flex-direction: column; gap: 12px; }
}

/* ===== 成就徽章系统 ===== */
.achievements-section {
  width: 100%;
  margin-bottom: 25px;
}

.achievements-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
  text-align: center;
}

.achievements-stats {
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent2);
  margin-bottom: 15px;
}

.achievements-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.achievement-badge {
  padding: 14px 10px;
  border-radius: 12px;
  background: var(--card);
  text-align: center;
  transition: all 0.3s;
  animation: fadeInUp 0.4s ease both;
}

.achievement-badge.unlocked {
  border: 1px solid rgba(253,203,110,0.4);
  background: linear-gradient(135deg, rgba(253,203,110,0.1), rgba(108,92,231,0.08));
}

.achievement-badge.locked {
  opacity: 0.3;
  filter: grayscale(1);
}

.achievement-icon { font-size: 2rem; margin-bottom: 5px; }

.achievement-name {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.achievement-badge.unlocked .achievement-name { color: var(--warning); }

.achievement-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ===== 骰子动画 ===== */
.dice-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.dice-box {
  text-align: center;
  padding: 40px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--bg), #1a1a3e);
  border: 2px solid var(--accent);
  animation: fadeInUp 0.4s ease;
}

.dice-rolling {
  font-size: 4rem;
  animation: diceShake 0.1s linear infinite;
}

@keyframes diceShake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-10deg) scale(1.1); }
  75% { transform: rotate(10deg) scale(1.1); }
}

.dice-text {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 15px;
}

.dice-rate {
  font-size: 0.9rem;
  color: var(--accent2);
  margin-top: 5px;
}

.dice-result {
  font-size: 2.5rem;
  font-weight: 900;
  margin-top: 15px;
}

.dice-result.success { color: var(--success); }
.dice-result.failure { color: var(--danger); }

.dice-subtext {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.choice-risk-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(253,203,110,0.2);
  color: var(--warning);
  margin-left: 6px;
}

