/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

#app {
  position: relative;
  min-height: 100vh;
}

/* 头部导航 */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: flex-end;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.7rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.nav-icon {
  font-size: 1.1rem;
}

/* 开始页面 */
.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
  padding-top: 80px; /* 为导航栏留出空间 */
}

.cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
  animation: float 20s infinite linear;
}

.cover-content {
  text-align: center;
  color: white;
  z-index: 2;
  position: relative;
  max-width: 600px;
  padding: 2rem;
  animation: fadeInUp 1s ease-out;
}

.logo-container {
  margin-bottom: 3rem;
}

.logo {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

.cover h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #fff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  line-height: 1.6;
}

.free-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(45deg, #10b981, #059669);
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  animation: pulse 2s infinite;
}

.free-icon {
  font-size: 1.1rem;
}

.features {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.8rem 1.2rem;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

.feature .icon {
  font-size: 1.2rem;
}

.start-btn {
  position: relative;
  background: linear-gradient(45deg, #ff6b6b, #ffa726);
  border: none;
  padding: 1rem 3rem;
  border-radius: 50px;
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
  overflow: hidden;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
}

.start-btn:active {
  transform: translateY(-1px);
}

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* 问卷页面 */
.questionnaire {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem 1rem;
  padding-top: 80px; /* 留出导航栏空间，防止进度条重叠 */
}

.header {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.progress-container {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.5s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

.progress-text {
  font-weight: 600;
  color: #667eea;
  min-width: 60px;
  text-align: center;
}

.question-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.question-preview {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  opacity: 0.6;
}

.prev-question, .next-question {
  flex: 1;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  padding: 1rem;
  min-height: 80px;
  transition: all 0.3s ease;
}

.prev-question:hover, .next-question:hover {
  opacity: 0.8;
  transform: scale(1.02);
}

.question-label {
  font-size: 0.8rem;
  color: #666;
  display: block;
  margin-bottom: 0.5rem;
}

.question-content {
  font-size: 0.9rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.current-question {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  position: relative;
  transform: translateX(0);
  animation: slideIn 0.5s ease-out;
}

.question-number {
  font-size: 0.9rem;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 1rem;
}

.question-text {
  font-size: 1.4rem;
  line-height: 1.6;
  color: #2d3748;
  font-weight: 500;
}

.answer-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto 2rem;
}

#answer {
  width: 100%;
  min-height: 120px;
  border: 2px solid #e2e8f0;
  border-radius: 15px;
  padding: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

#answer:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.char-count {
  position: absolute;
  bottom: -1.5rem;
  right: 1rem;
  font-size: 0.8rem;
  color: #666;
}

.controls {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.prev-btn {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #e9ecef;
}

.prev-btn:not(:disabled):hover {
  background: #e9ecef;
  transform: translateX(-2px);
}

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

.next-btn, .submit-btn {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.next-btn:hover, .submit-btn:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.question-dots {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 300px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2e8f0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.current {
  background: #667eea;
  transform: scale(1.3);
}

.dot.completed {
  background: #10b981;
}

.dot:hover {
  transform: scale(1.2);
}

/* 结果页面 */
.result {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
  margin-top: 80px; /* 给结果页加顶部间距，避免与导航栏重叠 */
}

.questionnaire {
  margin-top: 80px; /* 问卷页也加间距，防止导航栏遮挡 */
}

.cover {
  margin-top: 80px; /* 开始页也加间距，防止导航栏遮挡 */
}

.result-content {
  max-width: 700px;
  width: 100%;
  animation: fadeInUp 0.8s ease-out;
  margin: 0 auto;
}

.result-header {
  text-align: center;
  margin-bottom: 3rem;
  color: white;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease-out;
}

.result h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.mbti-type {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.result-details {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.analysis-section, .intro-section {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.6s ease-out;
}

.analysis-section h3, .intro-section h3 {
  margin-bottom: 1rem;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analysis-content, .intro-content {
  line-height: 1.7;
  color: #4a5568;
  font-size: 1.1rem;
}

.result-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.restart-btn, .share-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-btn {
  background: white;
  color: #667eea;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

.share-btn {
  background: linear-gradient(45deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* 加载动画 */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(102, 126, 234, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
  color: white;
  animation: fadeIn 0.5s ease-out;
}

.spinner-container {
  position: relative;
  margin-bottom: 2rem;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.spinner-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.spinner-dots span {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: dot-pulse 1.4s infinite ease-in-out both;
}

.spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

#loadingText {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.loading-tips {
  font-size: 0.9rem;
  opacity: 0.8;
  animation: fadeInUp 1s ease-out 0.5s both;
}

/* 修复进度条与导航栏重叠 */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: flex-end;
}

.questionnaire {
  padding-top: 80px; /* 留出导航栏空间，防止进度条重叠 */
}

.progress-container {
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .cover-content {
    padding: 1rem;
  }
  
  .features {
    gap: 1rem;
  }
  
  .feature {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }
  
  .questionnaire {
    padding: 1rem 0.5rem;
    padding-top: 65px; /* 调整问卷页面顶部内边距 */
  }
  
  .current-question {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .question-text {
    font-size: 1.2rem;
  }
  
  .controls {
    flex-direction: column;
    gap: 1rem;
  }
  
  .control-btn {
    width: 100%;
    justify-content: center;
  }
  
  .question-preview {
    flex-direction: column;
  }
  
  .result-details {
    gap: 1rem;
  }
  
  .analysis-section, .intro-section {
    padding: 1.5rem;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .restart-btn, .share-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .cover h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .current-question {
    padding: 1rem;
  }
  
  .question-text {
    font-size: 1.1rem;
  }
  
  #answer {
    min-height: 100px;
    padding: 1rem;
  }
}

/* 动画定义 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
  40%, 43% { transform: translateY(-30px); }
  70% { transform: translateY(-15px); }
  90% { transform: translateY(-4px); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a6fd8, #6b42a6);
}

/* TNT匹配样式 */
.tnt-match-section {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-radius: 20px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
  color: white;
  box-shadow: 0 10px 30px rgba(240, 147, 251, 0.3);
}

.tnt-match-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.tnt-matched-member {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 1.5rem;
  margin: 1rem 0;
  backdrop-filter: blur(10px);
}

.member-avatar {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.member-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.member-description {
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.9;
}

.tnt-no-match {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.tnt-all-members {
  margin-top: 1.5rem;
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.member-card {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.3s ease;
}

.member-card:hover {
  transform: translateY(-5px);
}

.member-emoji {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.member-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.member-mbti {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* 捐赠支持样式 */
.donate-section {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  border-radius: 20px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
  color: #8b4513;
  box-shadow: 0 10px 30px rgba(252, 182, 159, 0.3);
}

.donate-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #d2691e;
}

.donate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.donate-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #8b4513;
  max-width: 400px;
}

.donate-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.donate-qr img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s;
  display: block;
  margin: 0 auto;
}

.donate-qr img:hover {
  transform: scale(1.05);
}

.qr-hint {
  font-size: 0.9rem;
  color: #8b4513;
  opacity: 0.8;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .top-nav {
    padding: 0.8rem 1rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  .tnt-match-section, .donate-section {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }
  
  .members-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
  }

  .donate-qr img {
    width: 120px !important;
    height: 120px !important;
    object-fit: contain;
  }

  .donate-content {
    gap: 1rem !important;
  }
}
