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

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(145deg, #f7f0eb 0%, #e8ddd4 100%);
  min-height: 100vh;
  color: #2c2420;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page {
  display: none;
  width: 100%;
}

.page.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

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

/* ========== Home Page ========== */

.home-card {
  background: white;
  border-radius: 28px;
  padding: 48px 40px 40px;
  box-shadow: 0 24px 80px rgba(60, 40, 30, 0.10);
  position: relative;
  overflow: hidden;
}

.home-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #c9a96e, #b8915c, #c9a96e);
}

.enneagram-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 28px;
}

.ring-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  transition: transform 0.2s;
}

.ring-num:hover {
  transform: scale(1.15);
}

.ring-num:nth-child(1) { background: #e74c3c; }
.ring-num:nth-child(2) { background: #e67e22; }
.ring-num:nth-child(3) { background: #f1c40f; color: #333; }
.ring-num:nth-child(4) { background: #2ecc71; }
.ring-num:nth-child(5) { background: #3498db; }
.ring-num:nth-child(6) { background: #9b59b6; }
.ring-num:nth-child(7) { background: #1abc9c; }
.ring-num:nth-child(8) { background: #e74c3c; }
.ring-num:nth-child(9) { background: #34495e; }

.home-header {
  text-align: center;
  margin-bottom: 32px;
}

.home-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #2c2420;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.home-header .subtitle {
  font-size: 15px;
  color: #8a7a70;
  line-height: 1.6;
}

.hero-card {
  background: linear-gradient(135deg, #faf6f2 0%, #f2ebe4 100%);
  border-radius: 20px;
  padding: 36px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1.5px solid #e8ddd4;
  margin-bottom: 32px;
  position: relative;
}

.hero-card:hover {
  border-color: #c9a96e;
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 48px rgba(201, 169, 110, 0.18);
}

.hero-card:active {
  transform: translateY(-1px) scale(0.99);
}

.hero-card .icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a96e, #b8915c);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 34px;
  box-shadow: 0 8px 24px rgba(201, 169, 110, 0.3);
}

.hero-card h3 {
  font-size: 22px;
  font-weight: 700;
  color: #2c2420;
  margin-bottom: 8px;
}

.hero-card p {
  font-size: 14px;
  color: #7a6a60;
  line-height: 1.6;
  margin-bottom: 16px;
}

.hero-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #c9a96e, #b8915c);
  color: white;
  box-shadow: 0 4px 12px rgba(201, 169, 110, 0.25);
}

.hero-card .meta-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.hero-card .meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #8a7a70;
}

.home-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e0d5cc, transparent);
  margin-bottom: 24px;
}

.about-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #6a5a50;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.type-grid-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.type-grid-mini span {
  padding: 8px 6px;
  background: #f5f0eb;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
  color: #5a4a40;
  font-weight: 500;
  transition: all 0.2s;
}

.type-grid-mini span:hover {
  background: #e8ddd4;
  transform: translateY(-1px);
}

/* ========== Test Page ========== */

.card {
  background: white;
  border-radius: 28px;
  padding: 40px;
  box-shadow: 0 24px 80px rgba(60, 40, 30, 0.10);
}

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

.progress-bar-bg {
  height: 6px;
  background: #f0e8e2;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #c9a96e, #b8915c);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-text {
  text-align: right;
  font-size: 13px;
  color: #8a7a70;
  margin-top: 6px;
}

.question-area {
  margin-bottom: 28px;
}

.question-text {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
  color: #2c2420;
  min-height: 60px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-btn {
  padding: 14px 20px;
  border: 2px solid #ece4dd;
  border-radius: 14px;
  background: #faf7f4;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
  transition: all 0.2s ease;
  color: #4a3a30;
}

.option-btn:hover {
  border-color: #c9a96e;
  background: #f5efe8;
}

.option-btn.selected {
  border-color: #b8915c;
  background: #f0e8de;
  color: #6a4a20;
  font-weight: 600;
}

.option-btn .opt-label {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: #ece4dd;
  margin-right: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #8a7a70;
  transition: all 0.2s;
}

.option-btn.selected .opt-label {
  background: #c9a96e;
  color: white;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.btn-primary {
  background: linear-gradient(135deg, #c9a96e, #b8915c);
  color: white;
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 169, 110, 0.35);
}

.btn-secondary {
  background: #f0e8e2;
  color: #6a5a50;
}

.btn-secondary:hover {
  background: #e0d5cc;
}

/* ========== Result Page ========== */
.result-header {
  text-align: center;
  margin-bottom: 28px;
}

.result-badge {
  display: inline-block;
  background: linear-gradient(135deg, #c9a96e, #b8915c);
  color: white;
  padding: 20px 30px;
  border-radius: 20px;
  margin-bottom: 12px;
  box-shadow: 0 8px 32px rgba(201, 169, 110, 0.3);
}

.result-badge h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.result-badge p {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.4;
}

.main-type-section {
  text-align: center;
  margin-bottom: 20px;
}

.main-type-section h3 {
  font-size: 26px;
  color: #2c2420;
  margin-bottom: 8px;
}

.main-type-section .desc {
  font-size: 15px;
  color: #6a5a50;
  line-height: 1.5;
  margin-bottom: 4px;
}

.main-type-section .score-text {
  font-size: 13px;
  color: #8a7a70;
}

.wing-section {
  background: #f5efe8;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  text-align: center;
}

.wing-section h4 {
  font-size: 16px;
  color: #b8915c;
  margin-bottom: 4px;
}

.wing-section p {
  font-size: 14px;
  color: #6a5a50;
  line-height: 1.4;
}

.chart-section {
  margin-bottom: 24px;
  text-align: center;
}

.chart-section h4 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #5a4a40;
}

#chart-canvas {
  max-width: 100%;
  border-radius: 12px;
}

.ranking-section {
  margin-bottom: 24px;
}

.ranking-section h4 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #5a4a40;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f5efe8;
  padding: 10px 14px;
  font-size: 13px;
  color: #8a7a70;
  text-align: left;
  border-bottom: 2px solid #e0d5cc;
}

td {
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid #f0e8e2;
}

.main-row {
  background: #f0e8de !important;
  font-weight: 600;
  color: #6a4a20;
}

.main-row td {
  border-bottom-color: #c9a96e;
}

.result-actions {
  text-align: center;
  margin-top: 20px;
}

.btn-ghost {
  background: transparent;
  color: #8a7a70;
  border: 1.5px solid #e0d5cc;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-ghost:hover {
  background: #f5efe8;
  color: #5a4a40;
  border-color: #c9a96e;
}

.q-transition { animation: qFade 0.35s ease; }
@keyframes qFade { 0% { opacity:0.5; transform:translateY(4px); } 100% { opacity:1; transform:translateY(0); } }

/* ========== Responsive ========== */
@media (max-width: 600px) {
  .home-card {
    padding: 32px 20px 28px;
    border-radius: 22px;
  }

  .home-header h1 {
    font-size: 22px;
  }

  .ring-num {
    width: 34px;
    height: 34px;
    font-size: 11px;
  }

  .hero-card {
    padding: 28px 20px;
  }

  .hero-card .icon-wrap {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .hero-card h3 {
    font-size: 19px;
  }

  .hero-card .meta-row {
    flex-direction: column;
    gap: 6px;
  }

  .card {
    padding: 24px 18px;
    border-radius: 22px;
  }

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

  .option-btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .result-badge h2 {
    font-size: 18px;
  }

  .result-badge {
    padding: 16px 20px;
  }

  .main-type-section h3 {
    font-size: 20px;
  }

  .nav-buttons .btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ========== Type Detail Modal ========== */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
  animation: modalFade 0.3s ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: white;
  border-radius: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.2);
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from { transform: translateY(40px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  font-size: 28px;
  color: #8a7a70;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f0e8e2;
  color: #2c2420;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.modal-num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 22px;
  color: #2c2420;
  margin-bottom: 2px;
}

.modal-header p {
  font-size: 14px;
  color: #8a7a70;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  background: #faf7f4;
  border-radius: 14px;
  padding: 16px;
}

.detail-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #b8915c;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.detail-text {
  font-size: 15px;
  color: #4a3a30;
  line-height: 1.6;
}

.motto-row {
  background: linear-gradient(135deg, #faf6f2, #f2ebe4);
  border: 1.5px solid #e8ddd4;
}

.motto-text {
  font-size: 16px;
  font-weight: 600;
  color: #6a4a20;
  text-align: center;
}
