/* ============================================
   宠物MBTI测试网站 - 可爱治愈系样式
   ============================================ */

/* CSS变量定义 */
:root {
  --primary-color: #FF9A76;
  --primary-light: #FFB89A;
  --primary-dark: #E87A54;
  --secondary-color: #FFD93D;
  --bg-color: #FFF8F0;
  --bg-secondary: #FFEFE0;
  --text-primary: #5D4E37;
  --text-secondary: #8B7355;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(255, 154, 118, 0.15);
  --shadow-hover: 0 8px 30px rgba(255, 154, 118, 0.25);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: all 0.3s ease;
}

/* 暗色模式变量 */
[data-theme="dark"] {
  --primary-color: #FF8A65;
  --primary-light: #FFAB91;
  --primary-dark: #F4511E;
  --secondary-color: #FFD54F;
  --bg-color: #1a1a2e;
  --bg-secondary: #252542;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --white: #2d2d44;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* 容器 */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   首页样式
   ============================================ */

.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 40px 20px;
}

.hero-section {
  margin-bottom: 40px;
}

.pet-icons {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.main-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  text-shadow: 2px 2px 4px rgba(255, 154, 118, 0.2);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

/* 特性卡片 */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 40px;
}

.feature-card {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.feature-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* 按钮容器 */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 100;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(255, 154, 118, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 154, 118, 0.5);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary-dark);
  border: 2px solid var(--primary-light);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-large {
  padding: 20px 50px;
  font-size: 1.2rem;
}

/* ============================================
   测试页样式
   ============================================ */

.test-page {
  padding: 20px 0;
}

.test-header {
  text-align: center;
  margin-bottom: 30px;
}

.progress-section {
  margin-bottom: 30px;
}

.progress-bar {
  height: 12px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* 问题卡片 */
.question-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.question-number {
  display: inline-block;
  background: var(--primary-light);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-bottom: 15px;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 25px;
  line-height: 1.5;
}

/* 选项列表 */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  padding: 16px 20px;
  background: var(--bg-color);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 60px;
}

.option-item .option-radio {
  margin-top: 2px;
  flex-shrink: 0;
}

.option-item:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-light);
}

.option-item.selected {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--white);
}

.option-radio {
  width: 22px;
  height: 22px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  margin-right: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-item.selected .option-radio {
  background: var(--white);
}

.option-item.selected .option-radio::after {
  content: '';
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 50%;
}

.option-text {
  font-size: 1rem;
  line-height: 1.5;
}

/* 导航按钮 */
.test-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.nav-btn {
  padding: 14px 30px;
  font-size: 1rem;
}

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

/* ============================================
   结果页样式
   ============================================ */

.result-page {
  padding: 20px 0;
}

.result-header {
  text-align: center;
  margin-bottom: 30px;
}

.result-header h1 {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* 结果卡片 */
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
  text-align: center;
}

.type-image {
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
}

.type-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 5px;
}

.type-name-en {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.type-tagline {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-style: italic;
  padding: 15px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary-color);
}

.similarity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--secondary-color) 0%, #FFC107 100%);
  color: var(--text-primary);
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
  height: 36px;
  box-sizing: border-box;
}

/* 详情区块 */
.detail-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.detail-section h3 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section p {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 经典语录 */
.quote-section {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 25px;
  margin-bottom: 25px;
  text-align: center;
}

.quote-section .quote-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.quote-section p {
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.6;
}

/* 分享区域 */
.share-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
  text-align: center;
}

.share-section h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.share-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-btn.wechat {
  background: #07C160;
  color: white;
}

.share-btn.copy {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.share-btn.download {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
}

/* 底部操作 */
.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }
  
  .option-item {
    padding: 14px 16px;
    min-height: 56px;
  }
  
  .option-text {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .main-title {
    font-size: 1.8rem;
  }
  
  .pet-icons {
    font-size: 60px;
  }
  
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .question-card {
    padding: 20px;
  }
  
  .question-text {
    font-size: 1.1rem;
  }
  
  .option-item {
    padding: 14px 16px;
  }
  
  .test-navigation {
    flex-direction: column;
  }
  
  .nav-btn {
    width: 100%;
  }
  
  .type-image {
    width: 120px;
    height: 120px;
    font-size: 60px;
  }
  
  .type-name {
    font-size: 1.6rem;
  }
  
  .share-buttons {
    flex-direction: column;
  }
  
  .share-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   动画效果
   ============================================ */

.fade-in {
  animation: fadeIn 0.5s ease;
}

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

.slide-in {
  animation: slideIn 0.4s ease;
}

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

/* 加载动画 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 隐藏元素 */
.hidden {
  display: none !important;
}

/* ============================================
   结果页新增样式
   ============================================ */

/* 结果徽章组 */
.result-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 15px;
  align-items: stretch;
}

/* 稀有度徽章 */
.rarity-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  height: 36px;
  box-sizing: border-box;
}

.rarity-legendary {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff;
}

.rarity-epic {
  background: linear-gradient(135deg, #C0C0C0, #9370DB);
  color: #fff;
}

.rarity-rare {
  background: linear-gradient(135deg, #87CEEB, #4169E1);
  color: #fff;
}

.rarity-uncommon {
  background: linear-gradient(135deg, #90EE90, #3CB371);
  color: #fff;
}

.rarity-common {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* 雷达图区域 */
.radar-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
  text-align: center;
}

.radar-section h3 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 20px;
}

.radar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  overflow-x: auto;
}

#radar-chart {
  max-width: 100%;
  height: auto;
  min-width: 280px;
}

/* 维度说明 */
.dimensions-legend {
  text-align: left;
  font-size: 0.85rem;
}

.model-group {
  margin-bottom: 15px;
}

.model-group h4 {
  font-size: 0.9rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--bg-secondary);
}

.legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-color);
}

.legend-item.matched {
  background: rgba(255, 154, 118, 0.1);
  border-left: 3px solid var(--primary-color);
}

.legend-name {
  color: var(--text-secondary);
}

.legend-level {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.level-h {
  background: #FFE4E1;
  color: #CD5C5C;
}

.level-m {
  background: #F0F8FF;
  color: #4682B4;
}

.level-l {
  background: #F5F5DC;
  color: #8B7355;
}

.match-icon {
  color: var(--primary-color);
  font-weight: bold;
}

/* 可展开详情 */
.detail-expandable {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 25px;
  overflow: hidden;
}

.expand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  cursor: pointer;
  transition: var(--transition);
}

.expand-header:hover {
  background: var(--bg-color);
}

.expand-header h3 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin: 0;
}

.expand-icon {
  font-size: 1rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.expand-content {
  padding: 0 25px 25px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-block {
  margin-bottom: 20px;
}

.detail-block:last-child {
  margin-bottom: 0;
}

.detail-block h4 {
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.detail-block p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
  white-space: pre-line;
}
