/* ===== 村落人格测试 - 全页面样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8f9fc;
  --card-bg: #fff;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.06);
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── 首页 ── */
.page-index { max-width: 480px; margin: 0 auto; padding: 32px 20px 60px; }

.header {
  text-align: center; padding: 32px 0 20px;
}
.header .logo { font-size: 48px; margin-bottom: 8px; }
.header h1 { font-size: 28px; font-weight: 800; letter-spacing: 0.5px; }
.header p { color: var(--text-2); font-size: 15px; margin-top: 6px; }

.test-grid {
  display: grid; gap: 16px; margin-top: 8px;
}

.test-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 18px;
}
.test-card:active { transform: scale(0.98); }
.test-card .card-icon {
  font-size: 44px; flex-shrink: 0; width: 68px; height: 68px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px; color: #fff;
}
.test-card .card-info h3 { font-size: 17px; font-weight: 700; }
.test-card .card-info p { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.test-card .card-arrow { color: var(--text-3); font-size: 20px; flex-shrink: 0; margin-left: auto; }

.test-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.1); transform: translateY(-2px); }

.footer-info {
  text-align: center; margin-top: 32px; color: var(--text-3); font-size: 13px;
}
.footer-info span { color: #6366f1; }

/* ── 答题页 ── */
.page-quiz { max-width: 520px; margin: 0 auto; padding: 20px; }

.q-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 0 8px;
}
.q-back {
  width: 40px; height: 40px; border: none; background: var(--card-bg);
  border-radius: 12px; font-size: 18px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.q-test-name { font-size: 14px; color: var(--text-2); font-weight: 600; }

.q-progress { display: flex; align-items: center; gap: 12px; margin: 8px 0 24px; }
.q-progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.q-progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.q-progress-text { font-size: 12px; color: var(--text-3); white-space: nowrap; font-weight: 600; }

.q-container { opacity: 0; transform: translateX(30px); }
.q-container.q-visible { opacity: 1; transform: translateX(0); transition: 0.4s cubic-bezier(.4,0,.2,1); }
.q-container.q-exit { opacity: 0; transform: translateX(-30px); transition: 0.35s ease-in; }

.q-title {
  font-size: 22px; font-weight: 700; line-height: 1.45;
  margin-bottom: 28px; color: var(--text);
}

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

.q-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 2px solid var(--border);
  border-radius: 14px; background: var(--card-bg);
  cursor: pointer; transition: var(--transition);
  text-align: left; font-family: inherit; font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
.q-option:active { transform: scale(0.985); }
.q-option.selected {
  border-color: #6366f1; background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.q-opt-letter {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; font-weight: 700; font-size: 13px;
  color: var(--text-2); flex-shrink: 0;
  transition: var(--transition);
}
.q-option.selected .q-opt-letter {
  background: #6366f1; color: #fff;
}

/* ── 结果页 ── */
.page-result { max-width: 480px; margin: 0 auto; padding: 20px; }

.result-hero {
  text-align: center; padding: 40px 20px 32px; border-radius: 24px;
  position: relative; overflow: hidden; color: #fff;
}
.result-hero::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.result-hero::after {
  content: ''; position: absolute; bottom: -80px; left: -40px;
  width: 240px; height: 240px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.result-emoji { font-size: 80px; position: relative; z-index: 1; }
.result-type { font-size: 34px; font-weight: 800; margin: 8px 0 12px; position: relative; z-index: 1; }
.result-desc { font-size: 15px; line-height: 1.6; opacity: 0.85; position: relative; z-index: 1; max-width: 340px; margin: 0 auto; }
.result-motto { font-size: 14px; opacity: 0.65; font-style: italic; margin-top: 10px; position: relative; z-index: 1; }

.result-pct {
  text-align: center; margin: 20px 0 12px; padding: 20px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.result-pct .pct-num { font-size: 36px; font-weight: 800; color: #6366f1; }
.result-pct .pct-label { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.result-actions {
  display: flex; flex-direction: column; gap: 12px; margin: 20px 0 8px;
}
.result-actions.row {
  flex-direction: row;
}
.result-actions.row .btn {
  flex: 1;
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 24px; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: var(--transition); -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #6366f1; color: #fff; box-shadow: 0 4px 16px rgba(99,102,241,.3); }
.btn-primary:hover { background: #4f46e5; }
.btn-outline { background: var(--card-bg); color: var(--text); border: 2px solid var(--border); }
.btn-emerald { background: #10b981; color: #fff; box-shadow: 0 4px 16px rgba(16,185,129,.3); }

.result-retry { text-align: center; margin: 16px 0 32px; }
.result-retry a { color: var(--text-3); font-size: 14px; text-decoration: none; }

.result-more {
  margin-top: 24px; padding: 20px; background: var(--card-bg);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.result-more .more-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.result-more .more-list { display: flex; flex-direction: column; gap: 10px; }
.result-more .more-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border-radius: 12px; border: 1.5px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.result-more .more-item:active { background: #f8fafc; }
.result-more .more-icon { font-size: 28px; }
.result-more .more-info { flex: 1; }
.result-more .more-info .n { font-size: 14px; font-weight: 600; }
.result-more .more-info .d { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.result-more .more-arrow { color: var(--text-3); }

/* ── 海报弹窗 ── */
.poster-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.85);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px;
}
.poster-overlay img { max-width: 90vw; max-height: 70vh; border-radius: 12px; }
.poster-tip { color: #fff; font-size: 14px; margin-top: 16px; opacity: 0.7; }
.poster-close {
  margin-top: 12px; padding: 10px 28px; background: rgba(255,255,255,.15);
  color: #fff; border: none; border-radius: 10px; font-size: 14px; cursor: pointer;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 24px;
  border-radius: 10px; font-size: 14px; z-index: 2000;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ── 加载 ── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-3); font-size: 15px;
}

/* ── 响应式微调 ── */
@media (min-width: 520px) {
  .test-grid { grid-template-columns: 1fr 1fr; }
  .test-card { flex-direction: column; text-align: center; padding: 28px 20px; }
  .test-card .card-arrow { display: none; }
}
