* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #ffc107;
  --primary-light: #ffd54f;
  --primary-dark: #f57f17;
  --bg-light: #fff8e1;
  --bg-white: #ffffff;
  --text-dark: #2d2d2d;
  --text-gray: #666666;
  --border-color: #ffecb3;
  --accent-color: #ffc107;
  --success-color: #4caf50;
  --shadow: 0 4px 15px rgba(255, 193, 7, 0.1);
  --shadow-hover: 0 8px 25px rgba(255, 193, 7, 0.15);
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  color: var(--text-dark);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

#app {
  width: 100%;
  max-width: 800px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 容器样式 */
.container {
  background: var(--bg-white);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease-out;
  width: 100%;
}

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

/* 首页样式 */
.home-page {
  text-align: center;
  padding: 20px;
}

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

.logo-wrapper {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
  animation: bounce 2s infinite;
}

.logo-emoji {
  font-size: 32px;
  animation: float 3s ease-in-out infinite;
}

.logo-emoji:nth-child(2) { animation-delay: 0.2s; }
.logo-emoji:nth-child(3) { animation-delay: 0.4s; }
.logo-emoji:nth-child(4) { animation-delay: 0.6s; }
.logo-emoji:nth-child(5) { animation-delay: 0.8s; }
.logo-emoji:nth-child(6) { animation-delay: 1s; }

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.home-page h1 {
  font-size: 56px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffc107 0%, #ffd54f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: -1px;
}

.home-page h2 {
  font-size: 28px;
  color: var(--text-dark);
  margin-bottom: 32px;
  font-weight: 600;
  opacity: 0.9;
}

.intro-text {
  background: var(--bg-light);
  border-radius: 16px;
  padding: 24px;
  margin: 0 auto 32px;
  max-width: 600px;
  text-align: left;
}

.intro-text p {
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
}

.intro-text p:last-child {
  margin-bottom: 0;
}

.intro-text strong {
  color: var(--primary-dark);
}

.warning-box {
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  border: 2px solid #ffd54f;
  border-radius: 12px;
  padding: 20px;
  margin: 0 auto 32px;
  max-width: 600px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
}

.warning-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.warning-content {
  flex: 1;
}

.warning-content strong {
  color: #f57f17;
}

.warning-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dark);
}

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

.test-info {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.info-item {
  background: var(--bg-light);
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.start-btn {
  background: linear-gradient(135deg, #ffc107 0%, #ffd54f 100%);
  color: #2d2d2d;
  border: none;
  padding: 18px 56px;
  font-size: 20px;
  border-radius: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 193, 7, 0.4);
}

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

.btn-icon {
  font-size: 24px;
}

.home-page .footer {
  margin-top: 40px;
  font-size: 14px;
  color: var(--text-gray);
}

.footer-note {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 8px;
}

/* 测试页样式 */
.test-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 20px;
}

.test-header h3 {
  font-size: 14px;
  color: var(--text-gray);
}

.progress {
  flex: 1;
  margin: 0 20px;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffc107 0%, #ffd54f 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.question-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.question-text {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 30px;
  color: var(--text-dark);
  line-height: 1.6;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  font-size: 16px;
  color: var(--text-dark);
}

.option:hover {
  border-color: var(--primary-color);
  background: rgba(255, 193, 7, 0.05);
  transform: translateX(4px);
}

.option input[type="radio"] {
  margin-right: 12px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .option {
    min-height: 48px; /* 确保触摸目标足够大 */
    padding: 16px 18px;
  }
  
  .option:active {
    background: rgba(255, 193, 7, 0.1);
    transform: scale(0.98);
  }
  
  .start-btn,
  .btn {
    min-height: 48px;
    padding: 14px 24px;
  }
  
  .start-btn:active,
  .btn:active {
    transform: scale(0.96);
  }
  
  .animal-card {
    min-height: 120px;
  }
  
  .animal-card:active {
    transform: scale(0.98);
  }
}

/* 防止移动端双击缩放 */
* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 改善移动端滚动体验 */
.container {
  -webkit-overflow-scrolling: touch;
}

/* 移动端字体大小调整 */
@media (max-width: 768px) {
  html {
    font-size: 16px; /* 防止iPhone Safari自动缩放 */
  }
  
  input,
  textarea,
  select {
    font-size: 16px; /* 防止iOS缩放输入框 */
  }
}

.option.selected {
  border-color: var(--primary-color);
  background: rgba(255, 193, 7, 0.08);
}

.test-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
}

.btn {
  padding: 12px 28px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-secondary {
  background: var(--border-color);
  color: var(--text-dark);
}

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

.btn-primary {
  background: linear-gradient(135deg, #ffc107 0%, #ffd54f 100%);
  color: #2d2d2d;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

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

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

/* 结果页样式 */
.result-page {
  text-align: center;
}

.result-page h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: var(--text-dark);
  font-weight: 600;
}

.result-loading {
  font-size: 16px;
  color: var(--text-gray);
  margin-bottom: 30px;
}

.result-loading .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.animal-result {
  margin: 40px 0;
}

.animal-name {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.animal-emoji {
  font-size: 80px;
  margin-bottom: 20px;
}

.animal-description {
  font-size: 16px;
  color: var(--text-gray);
  line-height: 1.8;
  margin-bottom: 30px;
  text-align: left;
  background: var(--bg-light);
  padding: 20px;
  border-radius: 12px;
}

.traits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.trait {
  background: var(--bg-light);
  color: var(--primary-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.result-actions button {
  padding: 12px 28px;
}

/* 动物图鉴页面 */
.animals-page {
  text-align: center;
}

.animals-page h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--text-dark);
  font-weight: 600;
}

.animals-page .subtitle {
  font-size: 16px;
  color: var(--text-gray);
  margin-bottom: 30px;
}

.animals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.animal-card {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 213, 79, 0.05) 100%);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.animal-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.animal-card .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.animal-card .name {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.animal-card .desc {
  font-size: 13px;
  color: var(--text-gray);
  line-height: 1.5;
}

.back-btn {
  background: var(--border-color);
  color: var(--text-dark);
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}

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

.back-header {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
}

.back-header:hover {
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 10px;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
  }

  #app {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    padding-top: 20px;
  }

  .container {
    padding: 20px;
    border-radius: 16px;
    margin: 0 auto;
    max-width: 100%;
  }

  .home-page {
    padding: 10px;
  }

  .home-page h1 {
    font-size: 36px;
    margin-bottom: 12px;
    line-height: 1.2;
  }

  .home-page h2 {
    font-size: 18px;
    margin-bottom: 24px;
  }

  .logo-wrapper {
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .logo-emoji {
    font-size: 24px;
  }

  .intro-text {
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 12px;
  }

  .intro-text p {
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
  }

  .warning-box {
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 10px;
    gap: 10px;
  }

  .warning-icon {
    font-size: 18px;
  }

  .warning-content {
    font-size: 13px;
    line-height: 1.4;
  }

  .test-info {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
  }

  .info-item {
    font-size: 13px;
    padding: 10px 16px;
    justify-content: center;
    border-radius: 16px;
  }

  .start-btn {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: 24px;
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .btn-icon {
    font-size: 20px;
  }

  .home-page .footer {
    margin-top: 30px;
    font-size: 12px;
  }

  .footer-note {
    font-size: 11px;
  }

  /* 测试页面移动端优化 */
  .test-page {
    min-height: calc(100vh - 40px);
    padding: 10px 0;
  }

  .test-header {
    flex-direction: column;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 24px;
  }

  .test-header h3 {
    font-size: 12px;
    text-align: center;
  }

  .progress {
    margin: 0;
    width: 100%;
    height: 6px;
  }

  .question-container {
    padding: 10px 0;
    min-height: calc(100vh - 200px);
    justify-content: flex-start;
  }

  .question-text {
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: left;
  }

  .options {
    gap: 10px;
  }

  .option {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
    line-height: 1.4;
  }

  .option input[type="radio"] {
    margin-right: 10px;
  }

  .test-footer {
    flex-direction: column-reverse;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
  }

  .btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 18px;
  }

  /* 结果页面移动端优化 */
  .result-page h2 {
    font-size: 24px;
    margin-bottom: 16px;
  }

  .result-animal {
    margin-bottom: 24px;
  }

  .animal-emoji {
    font-size: 48px;
  }

  .animal-name {
    font-size: 20px;
  }

  .animal-description {
    font-size: 14px;
    padding: 0 10px;
    line-height: 1.5;
  }

  .personality-traits {
    margin-bottom: 24px;
  }

  .personality-traits h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .traits-list {
    gap: 8px;
  }

  .trait {
    font-size: 12px;
    padding: 6px 12px;
  }

  .personality-details {
    margin-bottom: 24px;
  }

  .personality-details h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .details-grid {
    gap: 12px;
  }

  .detail-item {
    padding: 12px;
    border-radius: 10px;
  }

  .detail-item h4 {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .detail-item p {
    font-size: 12px;
  }

  .result-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
  }

  .result-actions button {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
  }

  /* 动物图鉴页面移动端优化 */
  .animals-page {
    padding: 10px;
  }

  .animals-page h2 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .animals-page .subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .animals-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
  }

  .animal-card {
    padding: 16px 12px;
    border-radius: 12px;
  }

  .animal-card .emoji {
    font-size: 36px;
    margin-bottom: 8px;
  }

  .animal-card .name {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .animal-card .desc {
    font-size: 12px;
  }

  .back-btn {
    padding: 8px 20px;
    font-size: 13px;
    margin-top: 20px;
  }

  .back-header {
    margin-bottom: 20px;
    font-size: 14px;
  }

  /* 小屏幕手机优化 */
  @media (max-width: 375px) {
    .home-page h1 {
      font-size: 32px;
    }

    .home-page h2 {
      font-size: 16px;
    }

    .logo-emoji {
      font-size: 20px;
    }

    .container {
      padding: 16px;
    }

    .start-btn {
      font-size: 15px;
      padding: 12px 28px;
    }

    .question-text {
      font-size: 15px;
    }

    .option {
      font-size: 13px;
      padding: 10px 12px;
    }
  }

  /* 横屏模式优化 */
  @media (max-height: 500px) and (orientation: landscape) {
    body {
      padding: 5px;
    }

    .container {
      padding: 12px;
      border-radius: 12px;
    }

    .home-page h1 {
      font-size: 28px;
      margin-bottom: 8px;
    }

    .home-page h2 {
      font-size: 16px;
      margin-bottom: 16px;
    }

    .logo-wrapper {
      margin-bottom: 12px;
    }

    .intro-text {
      padding: 12px;
      margin-bottom: 16px;
    }

    .warning-box {
      padding: 12px;
      margin-bottom: 16px;
    }

    .start-btn {
      padding: 10px 24px;
      font-size: 14px;
    }

    .question-container {
      min-height: calc(100vh - 150px);
    }

    .question-text {
      font-size: 14px;
      margin-bottom: 12px;
    }

    .option {
      padding: 8px 12px;
      font-size: 12px;
    }

    .test-footer {
      margin-top: 12px;
      padding-top: 12px;
    }
  }
}

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