/* ================================================================
 * CARTI - 座驾人格测试
 * 视觉样式表
 *
 * 目录：
 *   1. 基础重置 & 全局变量
 *   2. body & 背景层
 *   3. 通用布局
 *   4. 页面切换动画
 *   5. Landing 页（首页）
 *   6. 答题页
 *   7. 结果页
 *   8. 底部 16 车画廊
 *   9. 响应式
 * ================================================================ */

/* ================================================================
 * 1. 基础重置 & 全局变量
 * ================================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 配色体系 — 暗黑奢感 */
  --bg-base:       #08080c;  /* 最深背景 */
  --bg-deep:       #0c0c12;  /* 页面底色 */
  --surface:       rgba(255, 255, 255, 0.04);   /* 卡片底色 */
  --surface-hover: rgba(255, 255, 255, 0.08);   /* 悬停态 */
  --border:        rgba(255, 255, 255, 0.07);   /* 细线边框 */
  --border-hi:     rgba(255, 255, 255, 0.14);   /* 高亮边框 */

  /* 强调色 — 琥珀金 */
  --gold:        #c9a85c;
  --gold-dim:    rgba(201, 168, 92, 0.15);
  --gold-border: rgba(201, 168, 92, 0.35);
  --gold-glow:  rgba(201, 168, 92, 0.25);

  /* 文字层次 */
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-body:    rgba(255, 255, 255, 0.65);
  --text-muted:   rgba(255, 255, 255, 0.38);
  --text-faint:   rgba(255, 255, 255, 0.22);

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  /* 过渡 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ================================================================
 * 2. body & 背景层
 * ================================================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
               sans-serif;
  background: var(--bg-base);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 全局暗色纹理 + 背景图叠加层 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,168,92,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(201,168,92,0.04) 0%, transparent 50%);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* 全局细微噪点纹理 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ================================================================
 * 3. 通用布局
 * ================================================================ */
.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* ================================================================
 * 4. 页面切换动画
 * ================================================================ */
.page {
  display: none;
  animation: pageIn 0.5s var(--ease-out) forwards;
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================================================
 * 5. Landing 页（首页）
 * ================================================================ */
.landing {
  text-align: center;
  padding: 60px 0;
}

/* 顶部徽章 */
.badge {
  display: inline-block;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 36px;
}

/* CARTI 大标题 */
.logo {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 12px;
  line-height: 1;
  margin-bottom: 16px;
  background: linear-gradient(
    145deg,
    #e8c96a 0%,
    #c9a85c 30%,
    #a07838 60%,
    #c9a85c 80%,
    #e8c96a 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 52px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* 主信息卡片 */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
}

.hero-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: radial-gradient(ellipse at 50% 100%, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* 数据统计行 */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 32px;
}

.stat-item {
  text-align: center;
  position: relative;
}

.stat-item + .stat-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border-hi);
}

.stat-num {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(145deg, #e8c96a, #c9a85c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* 说明文字 */
.description {
  text-align: left;
  line-height: 1.85;
  color: var(--text-body);
  font-size: 0.92rem;
}

.description p {
  margin-bottom: 12px;
  padding-left: 18px;
  position: relative;
}

.description p:last-child {
  margin-bottom: 0;
}

.description p::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

/* 分类标签行 */
.categories {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.category-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* 作者信息 */
.author-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
  font-size: 0.8rem;
  color: var(--text-faint);
  line-height: 1.85;
  text-align: left;
}

.author-section p {
  margin-bottom: 10px;
}

.author-section p:last-of-type {
  margin-bottom: 16px;
}

.author-section strong {
  color: var(--text-muted);
  font-weight: 500;
}

.author-section .categories {
  margin-top: 4px;
}

/* 开始按钮 */
.start-btn {
  background: transparent;
  border: 1.5px solid var(--gold-border);
  color: var(--gold);
  padding: 18px 64px;
  font-size: 0.95rem;
  border-radius: 60px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.35s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.start-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--gold-glow) 50%,
    transparent 100%
  );
  transition: left 0.5s var(--ease-out);
}

.start-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  box-shadow: 0 0 30px var(--gold-glow), inset 0 0 20px rgba(201,168,92,0.08);
  transform: translateY(-2px);
}

.start-btn:hover::before {
  left: 100%;
}

.start-btn:active {
  transform: translateY(0);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0 16px;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

/* ================================================================
 * 6. 答题页
 * ================================================================ */
.quiz-header {
  text-align: center;
  margin-bottom: 24px;
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-border), var(--gold));
  border-radius: 1px;
  transition: width 0.5s var(--ease-out);
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.quiz-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}

.back-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.dimension-tag {
  background: rgba(201,168,92,0.1);
  border: 1px solid rgba(201,168,92,0.25);
  color: var(--gold);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* 16车契合度排名 */
.ranking-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 20px 16px;
  margin-bottom: 20px;
}

.ranking-title {
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
  text-align: center;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-note {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.6;
  text-align: left;
}

.ranking-note span {
  color: var(--accent);
  font-weight: 600;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s;
  cursor: default;
}

.ranking-item:hover {
  background: rgba(201,168,92,0.06);
  border-color: rgba(201,168,92,0.15);
}

.ranking-item.top-3 {
  border-color: rgba(201,168,92,0.3);
  background: rgba(201,168,92,0.05);
}

.ranking-item.top-1 {
  border-color: rgba(201,168,92,0.5);
  background: rgba(201,168,92,0.1);
}

.ranking-rank {
  font-size: 0.65rem;
  color: var(--text-faint);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ranking-item.top-1 .ranking-rank { color: #c9a85c; font-weight: 700; }
.ranking-item.top-2 .ranking-rank { color: #b8b8b8; font-weight: 700; }
.ranking-item.top-3 .ranking-rank { color: #c4956a; font-weight: 700; }

.ranking-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}

.ranking-info {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-size: 0.75rem;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-mbti {
  font-size: 0.62rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

.ranking-bar-wrap {
  flex: 0 0 80px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ranking-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(201,168,92,0.5), #c9a85c);
  border-radius: 2px;
  transition: width 0.8s var(--ease-out);
}

.ranking-pct {
  font-size: 0.62rem;
  color: var(--text-faint);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* 题目卡片 */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px 30px;
  margin-bottom: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 40px;
  border-top: 1px solid var(--gold-border);
  border-left: 1px solid var(--gold-border);
  border-radius: var(--r-xl) 0 0 0;
}

.question-number {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.question-text {
  font-size: 1.18rem;
  line-height: 1.75;
  margin-bottom: 28px;
  color: var(--text-primary);
  font-weight: 400;
}

/* 选项列表 */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 22px;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  text-align: left;
  font-size: 0.92rem;
  color: var(--text-body);
  position: relative;
  overflow: hidden;
  padding-left: 30px;
}

.option::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.2s ease;
}

.option:hover {
  background: var(--surface-hover);
  border-color: var(--border-hi);
  color: var(--text-primary);
  padding-left: 34px;
}

.option:hover::before {
  background: var(--gold-border);
}

.option:active {
  transform: scale(0.99);
}

/* ================================================================
 * 7. 结果页
 * ================================================================ */
.result-header {
  text-align: center;
  margin-bottom: 28px;
}

.result-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.result-mbti {
  font-size: 5.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 10px;
  background: linear-gradient(
    145deg,
    #f0d78c 0%,
    #c9a85c 35%,
    #a07838 60%,
    #c9a85c 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.result-car-name {
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.result-car-type {
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 2px;
}

/* 结果主卡片 */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
}

/* 车辆图片 — 懒加载骨架屏 */
.result-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--r-md);
  margin-bottom: 22px;
  display: block;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  transition: opacity 0.5s ease;
}

.result-image.loaded {
  background: none;
  animation: none;
}

/* 车辆描述 */
.result-description {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-body);
  text-align: justify;
}

.result-description p {
  margin: 0 0 12px 0;
}

.result-description p:last-child {
  margin-bottom: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
  font-style: italic;
}

/* MBTI 人格解读区块 */
.mbti-explanation {
  background: rgba(201, 168, 92, 0.04);
  border: 1px solid rgba(201, 168, 92, 0.12);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-top: 20px;
}

.mbti-explanation h3 {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.mbti-explanation p {
  color: var(--text-body);
  line-height: 1.9;
  font-size: 0.88rem;
  white-space: pre-line;
}

.mbti-explanation .mbti-highlight {
  display: block;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  letter-spacing: 0.3px;
}

/* 分享 / 重试 按钮区 */
.share-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.share-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-hi);
  color: var(--text-body);
  padding: 14px 32px;
  font-size: 0.88rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.25s var(--ease-out);
  letter-spacing: 0.5px;
}

.share-btn:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

.retry-btn {
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  padding: 14px 32px;
  font-size: 0.88rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s var(--ease-out);
  letter-spacing: 0.5px;
}

.retry-btn:hover {
  background: rgba(201, 168, 92, 0.22);
  border-color: var(--gold);
  transform: translateY(-1px);
}

/* ================================================================
 * 8. 底部 16 车画廊
 * ================================================================ */
.gallery-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.gallery-title {
  font-size: 0.72rem;
  color: var(--text-faint);
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
  text-align: center;
  transition: all 0.25s var(--ease-out);
  overflow: hidden;
}

.gallery-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-hi);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 7px;
  margin-bottom: 7px;
  display: block;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  transition: opacity 0.4s ease;
}

.gallery-item img.loaded {
  background: none;
  animation: none;
  opacity: 1;
}

.gallery-item .car-name {
  font-size: 0.7rem;
  color: var(--text-body);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.gallery-item .car-mbti {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 1px;
}

/* ================================================================
 * 9. 响应式
 * ================================================================ */
@media (max-width: 480px) {
  .logo          { font-size: 3.5rem; letter-spacing: 6px; }
  .tagline       { font-size: 0.9rem; }
  .stats-row     { gap: 32px; }
  .stat-num      { font-size: 2.2rem; }
  .hero-card     { padding: 28px 20px; }
  .question-card { padding: 32px 22px; }
  .question-text { font-size: 1.05rem; }
  .result-mbti   { font-size: 4rem; letter-spacing: 6px; }
  .result-image  { height: 160px; }
  .gallery-grid  { grid-template-columns: 1fr; }
  .share-section { flex-direction: column; }
  .share-btn, .retry-btn { width: 100%; text-align: center; }
}
