/*
 * 觉知之镜 · 黑金雅致风格 (Neo-Dark Zen Luxury)
 * 深邃、流光、高雅
 */

/* ==================== 基础变量 ==================== */
:root {
  /* 背景色系 - 极致深邃 */
  --bg-primary: #050507;       /* 近乎纯黑的午夜蓝 */
  --bg-secondary: #0f0f13;     /* 深灰 */
  --bg-card: rgba(20, 20, 26, 0.6); /* 磨砂玻璃基底 */
  --bg-overlay: rgba(0, 0, 0, 0.4);
  
  /* 金色系 - 高雅流光 */
  --gold-primary: #d4af37;     /* 香槟金 */
  --gold-light: #f2d06b;       /* 亮金 */
  --gold-dim: #8a7035;         /* 暗金 */
  --gold-gradient: linear-gradient(135deg, #d4af37 0%, #f2d06b 50%, #d4af37 100%);
  
  /* 文字颜色 */
  --text-primary: #ececec;     /* 钛白 */
  --text-secondary: #a0a0a0;   /* 银灰 */
  --text-muted: #666666;       /* 铁灰 */
  
  /* 辅助色 */
  --accent-glow: rgba(212, 175, 55, 0.15); /* 金色光晕 */
  --border-color: rgba(212, 175, 55, 0.2); /* 极细金边 */
  --border-hover: rgba(212, 175, 55, 0.5);
  
  /* 字体 */
  --font-serif: "Noto Serif SC", "Source Han Serif CN", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", sans-serif;
  
  /* 间距与布局 */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2.5rem;
  --spacing-xl: 4rem;
  
  /* 圆角 & 模糊 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --blur-bg: blur(20px);
  
  /* 动效 */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 0%, #1a1a2e 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(212, 175, 55, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 噪点纹理叠加，增加质感 */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ==================== 布局容器 ==================== */
.container {
  width: 100%;
  max-width: 1000px; /* 加宽以防折行 */
  margin: 0 auto;
  padding: var(--spacing-md);
  position: relative;
  z-index: 1;
}

/* ==================== 排版与文字 ==================== */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--text-primary);
}

.title-main {
  font-size: 3rem;
  text-align: center;
  letter-spacing: 0.2em;
  background: linear-gradient(to bottom, #fff 30%, #ccc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(255,255,255,0.1);
  margin-bottom: var(--spacing-xs);
}

.title-sub {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  text-align: center;
  color: var(--gold-primary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 0px;
}

.text-center { text-align: center; }
.text-gold { color: var(--gold-primary); }
.text-muted { color: var(--text-muted); }

/* ==================== 磨砂卡片系统 ==================== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: var(--transition-slow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 12px 40px rgba(212, 175, 55, 0.05);
  transform: translateY(-2px);
}

/* ==================== 核心：版本选择器 (Grid 布局) ==================== */
/* 修复折行问题的关键：使用 Grid 而非 Flex wrap，并强制列宽 */
.version-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 强制三列等宽 */
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  width: 100%;
}

.version-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 悬停效果 */
.version-card:hover {
  background: rgba(255, 255, 255, 0.05); /* 保持冷色调，仅稍微提亮 */
  border-color: var(--gold-dim);
  transform: translateY(-1px); /* 位移减小 */
}

/* 选中状态 */
.version-card.selected {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.08) 0%, rgba(0,0,0,0) 100%);
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.1) inset;
}

.version-card.selected::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; width: 100%; height: 2px;
  background: var(--gold-primary);
  box-shadow: 0 -2px 10px var(--gold-primary);
}

.version-name {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
  transition: color 0.3s;
}

.version-card.selected .version-name,
.version-card:hover .version-name {
  color: var(--gold-primary);
}

.version-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.version-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.version-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-sm);
  line-height: 1.5;
  opacity: 0; /* 默认隐藏描述，保持简洁 */
  height: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

/* 选中或悬停时显示描述 */
.version-card:hover .version-desc,
.version-card.selected .version-desc {
  opacity: 1;
  height: auto;
  transform: translateY(0);
  margin-top: var(--spacing-sm);
}

.version-recommend {
  position: absolute;
  top: 0; right: 0;
  background: var(--gold-primary);
  color: #000;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-bottom-left-radius: 6px;
  font-weight: bold;
}

/* ==================== 表单元素 ==================== */
.welcome-form {
  width: 100%;
  max-width: 720px; /* 加宽容器 */
  margin: 0 auto;
  padding: var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--blur-bg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.input-group {
  margin-bottom: var(--spacing-lg);
  position: relative;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.input-label {
  display: block;
  font-size: 0.85rem;
  color: var(--gold-primary);
  margin-bottom: var(--spacing-xs);
  text-align: center;
  letter-spacing: 2px;
}

.input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-muted);
  padding: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  text-align: center;
  font-family: var(--font-serif);
  transition: var(--transition-fast);
  border-radius: 0;
}

.input:focus {
  outline: none;
  border-bottom-color: var(--gold-primary);
  box-shadow: 0 10px 20px -10px rgba(212, 175, 55, 0.1);
}

.section-title {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  margin-bottom: var(--spacing-sm);
  opacity: 0.6;
}

.input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 3rem;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--gold-primary);
  background: transparent;
  border: 1px solid var(--gold-primary);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--gold-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: -1;
}

.btn:hover {
  color: #000; /* 悬停变黑字 */
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  /* 默认样式已足够高雅，此处可作为重载 */
  min-width: 200px;
}

.btn-ghost {
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  box-shadow: none;
}

.btn-ghost::before { display: none; }

/* ==================== 欢迎页 ==================== */
.welcome-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-md);
}

.welcome-logo {
  font-size: 3.5rem;
  margin-bottom: var(--spacing-md);
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.3));
  animation: pulse 4s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.welcome-quote {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin: var(--spacing-lg) 0;
  padding: 0 var(--spacing-lg);
  text-align: center;
  max-width: 600px;
  line-height: 2;
  border-left: none; /* 去掉边框，改用符号 */
}

.welcome-features {
  display: flex;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 1px;
  opacity: 0.6;
}

/* ==================== 答题页 ==================== */
.quiz-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.quiz-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.quiz-progress {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.1);
  margin-bottom: var(--spacing-lg);
  position: relative;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  box-shadow: 0 0 10px var(--gold-primary);
  transition: width 0.5s ease;
}

.quiz-progress-text {
  position: absolute;
  right: 0; top: -20px;
  font-size: 0.75rem;
  color: var(--gold-dim);
}

.quiz-scenario {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 2;
  color: var(--text-primary);
  padding: var(--spacing-lg);
  margin-bottom:0px;
  text-align: center;
  /* 移除边框和背景，让文字悬浮 */
  background: transparent;
  border: none;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.quiz-options {
  display: grid;
  gap: var(--spacing-sm);
  max-width: 600px;
  margin: 0 auto;
}

.quiz-option {
  display: flex;
  align-items: center;
  padding: 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm); /* 更方正一点 */
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent; /* 禁用 iOS 点击高亮 */
  -webkit-touch-callout: none;
  user-select: none;
}

.quiz-option:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--gold-dim);
}

.quiz-option.selected {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.2) 0%, transparent 100%);
  border-color: var(--gold-primary);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.1) inset;
}

.quiz-option-marker {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  margin-right: var(--spacing-md);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.quiz-option.selected .quiz-option-marker {
  border-color: var(--gold-primary);
  background: var(--gold-primary);
  color: #000;
}

.quiz-option-text {
  color: var(--text-secondary);
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  flex: 1; /* 占据剩余空间 */
  word-wrap: break-word; /* 允许换行 */
  line-height: 1.4; /* 增加行间距 */
}

.quiz-option.selected .quiz-option-text {
  color: var(--text-primary);
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ==================== 结果页 ==================== */
.result-page {
  padding: var(--spacing-xl) 0;
}

.radar-container {
  max-width: 500px;
  margin: var(--spacing-xl) auto;
  padding: var(--spacing-md);
  /* 去除之前的圆形背景，直接悬浮 */
  background: transparent;
  box-shadow: none;
}

.result-summary {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  line-height: 1.8;
}

.result-summary-title {
  font-size: 1.1rem;
  color: var(--gold-light);
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.1em;
}

.result-summary-text {
  color: var(--text-secondary);
  font-size: 1rem;
}

.dimension-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-lg); /* 增大间距 */
}

.dimension-item {
  background: rgba(255,255,255,0.015); /* 极淡背景 */
  border: 1px solid rgba(255,255,255,0.03);
  padding: var(--spacing-lg); /* 增大内边距 */
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.3s ease;
}

.dimension-item:hover {
  background: rgba(255,255,255,0.03);
  transform: translateY(-2px);
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.dimension-name {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dimension-score {
  color: var(--gold-primary);
  font-size: 1.3rem;
  font-family: var(--font-serif);
  font-weight: bold;
}

.dimension-bar {
  background: rgba(255,255,255,0.05);
  height: 3px;
  border-radius: 3px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.dimension-bar-fill {
  background: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-primary);
  height: 100%;
  border-radius: 3px;
}

.dimension-tag {
  border: none !important;
  background: rgba(255, 255, 255, 0.06) !important;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-radius: 4px;
  margin-left: 0.5rem;
  opacity: 0.8;
}

.dimension-desc {
  color: var(--text-secondary);
  line-height: 1.8; /* 增加行高 */
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
  :root {
    --spacing-lg: 1.5rem;
    --spacing-xl: 2.5rem;
  }

  .container {
    padding: var(--spacing-sm);
    width: 100%;
    max-width: 100%;
  }

  .title-main {
    font-size: 2rem;
  }
  
  .welcome-logo {
    font-size: 2.5rem;
  }
  
  .welcome-form {
    padding: var(--spacing-md);
  }
  
  .version-selector {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .version-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    min-height: 60px;
  }

  .version-card .version-name {
    margin-bottom: 0;
    font-size: 1.2rem;
  }
  
  .version-count {
    display: block; /* 保留题数显示 */
    font-size: 0.85rem;
  }
  
  .version-time {
    display: none; /* 隐藏时间信息，精简展示 */
  }

  /* 如果想保留信息，可以这样改结构，或者仅精简 */
  .version-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    text-align: left;
    gap: 4px;
    align-items: center;
  }
  
  .version-name {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.25rem;
    margin: 0;
  }
  
  .version-recommend {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    border-radius: 4px;
    margin-left: auto;
  }
  
  .version-desc {
    grid-column: 1 / span 2;
    grid-row: 2;
    margin-top: 4px !important;
    font-size: 0.75rem;
    transform: none !important;
    height: auto !important;
    opacity: 0.8 !important; /* 手机端直接显示描述，因为没有 hover */
  }

  .input {
    font-size: 16px; /* 防止 iOS 自动缩放 */
  }
  
  .btn {
    padding: 0.8rem 1.5rem;
    width: 100%; /* 手机端按钮全宽体验更好 */
  }

  /* 答题页适配 */
  .quiz-header-small {
    display: none; /* 移动端隐藏顶部标题 */
  }
  
  .quiz-progress {
    display: none; /* 移动端隐藏进度条线 */
  }
  
  .quiz-scenario {
    font-size: 1.1rem;
    padding: var(--spacing-sm) 0;
    line-height: 1.6;
  }
  
  .quiz-options {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .quiz-option {
    padding: 1rem;
    min-height: 3.5rem; /* 保证触摸区域 */
  }
  
  .quiz-option-marker {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    flex-shrink: 0;
  }
  
  .quiz-option-text {
    font-size: 0.95rem;
  }

  /* 结果页适配 */
  .result-page {
    padding-top: var(--spacing-lg);
  }
  
  .radar-container {
    padding: 0;
    margin: var(--spacing-md) auto;
  }
  
  .dimension-list {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .dimension-item {
    padding: var(--spacing-md);
  }
  
  .result-summary {
    padding: var(--spacing-md);
  }
  
  .welcome-features {
    flex-direction: row;
    justify-content: space-around;
    gap: var(--spacing-sm);
    font-size: 0.7rem;
    width: 100%;
  }
  
  .welcome-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
}

/* 针对平板和桌面，保持三列 */
@media (min-width: 769px) {
  .version-selector {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================== 动画 ==================== */
.fade-in { animation: fadeIn 0.8s ease forwards; }
.slide-up { animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

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