/* ===== 全局变量 ===== */
:root {
  --val-red: #FF4655;
  --val-blue: #0F1923;
  --val-teal: #17D6B5;
  --val-accent: #1DB954;
  --val-gold: #FFD700;
  --card-radius: 16px;
  --card-shadow: 0 2px 16px rgba(0,0,0,0.06);
  --transition-speed: 0.4s;
}

/* ===== 基础重置 ===== */
* {
  box-sizing: border-box;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 页面切换动画 ===== */
.page {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
  pointer-events: none;
}

.page.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== 卡片通用样式 ===== */
.wati-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.wati-card:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

/* ===== 进度条 ===== */
.progress-bar-bg {
  background: #E5E7EB;
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  background: linear-gradient(90deg, var(--val-red), #FF6B7A);
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 选项按钮 ===== */
.option-btn {
  background: #fff;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 15px;
  line-height: 1.5;
  width: 100%;
  display: block;
}

.option-btn:focus {
  outline: none;
}

.option-btn:focus-visible {
  outline: none;
}

/* 仅在真正支持 hover 的设备上启用 hover 效果，防止移动端触摸后 hover 粘滞 */
@media (hover: hover) and (pointer: fine) {
  .option-btn:hover {
    border-color: var(--val-red);
    background: #FFF5F5;
    transform: translateX(4px);
  }
}

/* 移动端使用 active 伪类代替 hover，触摸松开后立即消失 */
@media (hover: none) {
  .option-btn:active {
    border-color: var(--val-red);
    background: #FFF5F5;
    transform: translateX(4px);
  }
}

.option-btn.selected {
  border-color: var(--val-red);
  background: linear-gradient(135deg, #FFF5F5, #FFE8EA);
  color: var(--val-red);
  font-weight: 600;
}

/* ===== 主按钮 ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--val-red), #E63946);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255,70,85,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255,70,85,0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ===== 维度进度条 ===== */
.dimension-bar-bg {
  background: #F3F4F6;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  flex: 1;
}

.dimension-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 加载动画 ===== */
.loading-spinner {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.loading-spinner .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--val-red);
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-spinner .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-spinner .dot:nth-child(2) { animation-delay: -0.16s; }
.loading-spinner .dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== 淡入动画 ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.fade-in-up-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-up-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-up-delay-3 { animation-delay: 0.3s; opacity: 0; }
.fade-in-up-delay-4 { animation-delay: 0.4s; opacity: 0; }
.fade-in-up-delay-5 { animation-delay: 0.5s; opacity: 0; }

/* ===== 标题渐变 ===== */
.gradient-title {
  background: linear-gradient(135deg, var(--val-red), #FF6B7A, var(--val-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 标签徽章 ===== */
.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge-green {
  background: #ECFDF5;
  color: #059669;
}

/* ===== 题目切换动画 ===== */
.question-enter {
  animation: slideInRight 0.4s ease forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== 脉冲动画 ===== */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,70,85,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(255,70,85,0); }
}

.pulse-glow {
  animation: pulse-glow 2s infinite;
}

/* ===== 桌面端适配（移动端优先） ===== */
@media (min-width: 769px) {
  .wati-card {
    padding: 28px;
    margin-bottom: 18px;
  }

  .btn-primary {
    padding: 16px 44px;
    font-size: 17px;
  }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* ===== 封面页样式（参考SBTI风格） ===== */
.welcome-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: #F7F8FA;
  position: relative;
  overflow: hidden;
}

/* 主内容区 */
.welcome-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 24px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Logo 圆形容器 */
.welcome-logo-wrap {
  margin-top: 16px;
  margin-bottom: 14px;
  animation: fadeInDown 0.6s ease forwards;
}

.welcome-logo-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 24px rgba(255,70,85,0.18), 0 0 0 4px rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.welcome-logo-circle:hover {
  transform: scale(1.06);
}

.welcome-logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* 标题区域 */
.welcome-title-area {
  text-align: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease 0.1s forwards;
  opacity: 0;
}

.welcome-main-title {
  font-size: 60px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #FF4655, #E63946);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin: 0 0 4px;
  line-height: 1.1;
}

.welcome-sub-title {
  font-size: 28px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 4px;
  letter-spacing: 6px;
}

.welcome-desc {
  font-size: 11px;
  color: #9CA3AF;
  margin: 0;
  letter-spacing: 1px;
  font-weight: 500;
}

/* 分隔装饰 */
.welcome-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
  animation: fadeInUp 0.6s ease 0.2s forwards;
  opacity: 0;
}

.welcome-divider-line {
  width: 32px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #FFB3BA, transparent);
  border-radius: 2px;
}

.welcome-divider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--val-red);
  box-shadow: 0 0 8px rgba(255,70,85,0.4);
}

/* 介绍卡片 */
.welcome-intro-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px 28px;
  width: 100%;
  text-align: center;
  box-shadow: 0 2px 20px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.03);
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease 0.3s forwards;
  opacity: 0;
}

.welcome-intro-main {
  font-size: 16px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 10px;
}

.welcome-intro-sub {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
  line-height: 1.7;
}

.welcome-intro-sub strong {
  color: var(--val-red);
  font-weight: 700;
}

/* 标签组 */
.welcome-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 28px;
  animation: fadeInUp 0.6s ease 0.4s forwards;
  opacity: 0;
}

.welcome-tag {
  background: #fff;
  border: 1px solid #F0F0F0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  color: #6B7280;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.welcome-tag:hover {
  border-color: #FFD0D5;
  background: #FFF5F5;
  color: var(--val-red);
}

/* 开始按钮 */
.welcome-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #FF4655, #E63946);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 24px rgba(255,70,85,0.35);
  letter-spacing: 1px;
  animation: fadeInUp 0.6s ease 0.5s forwards, pulse-glow 2.5s infinite 1s;
  opacity: 0;
}

.welcome-start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(255,70,85,0.45);
}

.welcome-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(255,70,85,0.3);
}

.welcome-start-btn svg {
  transition: transform 0.3s ease;
}

.welcome-start-btn:hover svg {
  transform: translateX(4px);
}

/* 测试人数统计徽章 */
.welcome-visitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 20px;
  background: linear-gradient(135deg, rgba(255,70,85,0.06), rgba(255,107,122,0.1));
  border: 1px solid rgba(255,70,85,0.12);
  border-radius: 999px;
  animation: fadeInUp 0.6s ease 0.55s forwards;
  opacity: 0;
}

.welcome-visitor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--val-red);
  animation: pulse-dot 1.8s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.welcome-visitor-text {
  font-size: 13px;
  color: #6B7280;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.welcome-visitor-num {
  font-weight: 800;
  color: var(--val-red);
  font-size: 15px;
  letter-spacing: 0.5px;
}

/* 底部提示 */
.welcome-footer-tip {
  font-size: 12px;
  color: #B0B8C1;
  margin-top: 16px;
  text-align: center;
  animation: fadeInUp 0.6s ease 0.6s forwards;
  opacity: 0;
}

/* 底部签名 */
.welcome-footer {
  position: relative;
  z-index: 1;
  padding: 16px 0 20px;
  text-align: center;
  font-size: 12px;
  color: #B0B8C1;
}

/* 新增动画 */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 桌面端适配（移动端优先） */
@media (min-width: 381px) {
  .welcome-main-title {
    font-size: 72px;
    letter-spacing: 8px;
  }

  .welcome-sub-title {
    font-size: 34px;
    letter-spacing: 8px;
  }

  .welcome-intro-card {
    padding: 24px 28px;
  }

  .welcome-tags {
    gap: 8px;
  }

  .welcome-tag {
    padding: 6px 14px;
    font-size: 12px;
  }

  .welcome-start-btn {
    padding: 16px 32px;
    font-size: 17px;
  }
}

/* ===== 结果页 SBTI 风格 ===== */
.sbti-result-root {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 10px 12px 16px;
}

/* SBTI 通用卡片 */
.sbti-card {
  background: #fff;
  border-radius: 20px;
  border: 1.5px solid #D6E4D9;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  margin-bottom: 12px;
  position: relative;
}

/* 卡片① 人格主卡片 */
.sbti-card-main {
  padding: 20px 18px 18px;
  text-align: center;
}

.sbti-card-badge-top {
  position: absolute;
  top: 16px;
  left: 20px;
}

.sbti-badge-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #B8D4BE;
  opacity: 0.7;
}

.sbti-label {
  font-size: 14px;
  color: #374151;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: 1px;
}

.sbti-name {
  font-size: 38px;
  font-weight: 900;
  color: #1F2937;
  margin: 0 0 4px;
  line-height: 1.15;
}

.sbti-code {
  font-size: 38px;
  font-weight: 800;
  color: #4ADE80;
  margin: 0 0 10px;
  letter-spacing: 4px;
}

/* 人格形象图 */
.sbti-avatar-wrap {
  width: 140px;
  height: 140px;
  margin: 10px auto;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #E8F5E9;
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.15);
  background: #F9FAFB;
}

.sbti-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sbti-avatar-wrap:hover .sbti-avatar-img {
  transform: scale(1.05);
}

.sbti-emoji {
  font-size: 80px;
  line-height: 1;
  margin: 0 0 20px;
}

.sbti-summary {
  font-size: 15px;
  color: #1F2937;
  font-weight: 700;
  margin: 10px 0 0;
  line-height: 1.6;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,70,85,0.06), rgba(255,107,122,0.10));
  border-left: 3px solid var(--val-red);
  border-radius: 0 12px 12px 0;
  letter-spacing: 0.5px;
  position: relative;
}

/* 卡片② 分享卡片 */
.sbti-card-detail {
  padding: 14px 18px;
  border-left: 4px solid #4ADE80;
  text-align: center;
}

.sbti-share-label {
  font-size: 17px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 10px;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.sbti-qrcode-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 10px;
}

.sbti-qrcode-img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  object-fit: contain;
}

.sbti-detail-label {
  font-size: 13px;
  color: #9CA3AF;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}

.sbti-detail-title {
  font-size: 22px;
  font-weight: 800;
  color: #1F2937;
  margin: 0 0 14px;
  line-height: 1.3;
}

.sbti-match-tag {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #059669;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* 操作按钮区 */
.sbti-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.sbti-restart-btn {
  width: 100%;
  max-width: 300px;
  padding: 14px 32px;
  background: #1F2937;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(31,41,55,0.2);
}

.sbti-restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(31,41,55,0.3);
  background: #374151;
}

.sbti-restart-btn:active {
  transform: translateY(0);
}

.sbti-footer-tip {
  font-size: 12px;
  color: #B0B8C1;
  margin: 0;
  text-align: center;
}

/* 结果页桌面端适配（移动端优先） */
@media (min-width: 381px) {
  .sbti-result-root {
    padding: 24px 16px 32px;
  }

  .sbti-name {
    font-size: 48px;
  }

  .sbti-code {
    font-size: 48px;
  }

  .sbti-emoji {
    font-size: 80px;
  }

  .sbti-avatar-wrap {
    width: 170px;
    height: 170px;
  }

  .sbti-detail-title {
    font-size: 26px;
  }

  .sbti-share-label {
    font-size: 19px;
  }

  .sbti-qrcode-img {
    width: 120px;
    height: 120px;
  }

  .sbti-card-main {
    padding: 32px 24px 28px;
  }

  .sbti-card-detail {
    padding: 24px;
  }
}
