/**
 * 人格类型测评 — 样式表
 */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #1f1f1f;
  background: #f0ede5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 容器 ===== */
.app-container {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
}

.page {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.35s ease;
}
.page.active { display: flex; }

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

/* ===== 字体辅助 ===== */
.serif {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
}

/* ===== 封面页 ===== */
#page-intro {
  justify-content: center;
  padding: 48px 0;
}

.intro-inner {
  text-align: left;
}

.intro-eyebrow {
  font-size: 0.78rem;
  color: #8a7a5e;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}

.intro-title {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
  margin-bottom: 20px;
}

.intro-desc {
  font-size: 0.92rem;
  color: #6b6b6b;
  line-height: 1.85;
  margin-bottom: 28px;
}

.intro-stats {
  font-size: 0.82rem;
  color: #9a958a;
  margin-bottom: 36px;
}

.intro-stats b {
  color: #5a5045;
  font-weight: 600;
  font-size: 0.95rem;
}

.intro-stats .dot {
  margin: 0 8px;
  color: #c8c0b0;
}

/* ===== 按钮 ===== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: #2b3a2e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  touch-action: manipulation;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-align: center;
}

.btn-primary:active {
  background: #1f2b22;
}

.btn-text {
  display: block;
  width: 100%;
  padding: 10px 0;
  font-size: 0.88rem;
  font-weight: 400;
  color: #8a8a8a;
  background: transparent;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
}

.btn-text:active {
  color: #5a5a5a;
}

.btn-prev {
  font-size: 0.84rem;
  font-weight: 400;
  color: #9a958a;
  background: transparent;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
  padding: 8px 0;
}

.btn-prev:active {
  color: #5a5045;
}

/* ===== 测试页 ===== */
#page-quiz {
  padding: 40px 0 32px;
}

.quiz-top {
  margin-bottom: 36px;
}

.progress-bar-track {
  width: 100%;
  height: 2px;
  background: #ddd6c8;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #2b3a2e;
  transition: width 0.35s ease;
  width: 0;
}

.progress-text {
  font-size: 0.76rem;
  color: #9a958a;
  margin-top: 10px;
  letter-spacing: 0.02em;
}

.question-section {
  flex: 1;
}

.question-text {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.55;
  margin-bottom: 28px;
}

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

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #3a3a3a;
  text-align: left;
  background: #faf8f4;
  border: 1px solid #e5e0d3;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  touch-action: manipulation;
  font-family: inherit;
}

.option-btn:active {
  border-color: #2b3a2e;
  background: #f0ede5;
}

.option-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #9a958a;
  border: 1px solid #d5cfc0;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.option-btn:active .option-label {
  color: #fff;
  background: #2b3a2e;
  border-color: #2b3a2e;
}

.option-text {
  flex: 1;
  padding-top: 1px;
}

.quiz-nav {
  margin-top: 32px;
}

/* ===== 结果页 ===== */
#page-result {
  padding: 40px 0 32px;
}

.result-inner {
  text-align: left;
}

.result-header {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid #ddd6c8;
}

.result-eyebrow {
  font-size: 0.78rem;
  color: #8a7a5e;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.result-code-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.result-code {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.02em;
  line-height: 1;
}

.result-name {
  font-size: 1.05rem;
  font-weight: 400;
  color: #5a5045;
}

.result-tagline {
  font-size: 0.88rem;
  color: #8a8a8a;
  margin-top: 12px;
  line-height: 1.6;
}

.result-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.trait-tag {
  font-size: 0.76rem;
  color: #5a5045;
  background: #e8e2d4;
  padding: 4px 12px;
  border-radius: 2px;
  font-weight: 400;
}

.result-block {
  margin-bottom: 32px;
}

.block-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #8a7a5e;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}

.result-description {
  font-size: 0.9rem;
  color: #3a3a3a;
  line-height: 1.9;
  white-space: pre-line;
}

/* 维度条 */
.dim-bar-group {
  margin-bottom: 18px;
}
.dim-bar-group:last-child { margin-bottom: 0; }

.dim-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.dim-left-label  { color: #2b3a2e; }
.dim-right-label { color: #8a7a5e; }

.dim-bar-track {
  display: flex;
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: #ddd6c8;
}

.dim-left-bar {
  background: #2b3a2e;
  transition: width 0.5s ease;
}

.dim-right-bar {
  background: #c4a86a;
  transition: width 0.5s ease;
}

.dim-bar-pcts {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #b0a890;
  margin-top: 3px;
}

/* 建议 */
.suggestions-list {
  list-style: none;
  counter-reset: tip;
}

.suggestions-list li {
  font-size: 0.88rem;
  color: #3a3a3a;
  line-height: 1.85;
  padding: 12px 0 12px 30px;
  position: relative;
  border-top: 1px solid #ebe5d8;
}

.suggestions-list li:first-child {
  border-top: none;
}

.suggestions-list li::before {
  counter-increment: tip;
  content: counter(tip) ".";
  position: absolute;
  left: 0;
  top: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #8a7a5e;
}

.result-actions {
  margin-top: 8px;
}

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

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 16px 0 24px;
  font-size: 0.72rem;
  color: #b0a890;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .app-container { padding: 0 20px; }

  .intro-title { font-size: 1.85rem; }
  .question-text { font-size: 1.1rem; }
  .option-btn { padding: 14px 15px; font-size: 0.88rem; }
  .result-code { font-size: 2rem; }
}

@media (min-width: 768px) {
  .intro-title { font-size: 2.6rem; }
  .question-text { font-size: 1.3rem; }
  .result-code { font-size: 2.8rem; }
}

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 28, 25, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: #faf8f4;
  border-radius: 8px;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.modal-step {
  text-align: left;
}

.modal-title {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.82rem;
  color: #8a8a8a;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-label {
  display: block;
  font-size: 0.78rem;
  color: #8a7a5e;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.92rem;
  color: #1f1f1f;
  background: #fff;
  border: 1px solid #d5cfc0;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.modal-input:focus {
  border-color: #2b3a2e;
}

.share-link-box {
  margin-bottom: 8px;
}

.modal-error {
  font-size: 0.8rem;
  color: #c0392b;
  min-height: 1.2em;
  margin-bottom: 8px;
}

.modal-expire {
  font-size: 0.76rem;
  color: #b0a890;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.modal-actions .btn-primary {
  flex: 1;
  width: auto;
}

.modal-actions .btn-text {
  flex-shrink: 0;
  width: auto;
  padding: 10px 16px;
  text-align: center;
}

.modal-loading {
  width: 28px;
  height: 28px;
  border: 3px solid #ddd6c8;
  border-top-color: #2b3a2e;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.7s linear infinite;
}

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

.modal-loading-text {
  font-size: 0.85rem;
  color: #8a8a8a;
  text-align: center;
}

/* ===== 分享页 ===== */
.share-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 0;
}

.share-loading .modal-loading {
  margin-bottom: 14px;
}

.share-status {
  text-align: center;
  padding: 80px 0;
}

.status-icon {
  font-size: 2.4rem;
  margin-bottom: 16px;
}

.status-text {
  font-family: "Noto Serif SC", "Source Han Serif SC",
               "Songti SC", "SimSun", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.status-desc {
  font-size: 0.85rem;
  color: #8a8a8a;
  margin-bottom: 24px;
}

.status-btn {
  display: inline-block;
  width: auto;
  padding: 12px 36px;
  text-decoration: none;
  text-align: center;
}

.share-result {
  padding: 40px 0 32px;
}

.share-user {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #ddd6c8;
}

.share-user-info {
  min-width: 0;
}

.share-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #e5e0d3;
  flex-shrink: 0;
}

.share-eyebrow {
  font-size: 0.72rem;
  color: #8a7a5e;
  letter-spacing: 0.08em;
}

.share-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-top: 2px;
}
