/* ══════════════════════════════════════
   SBTI 多场景人格平台 · 样式表
   ══════════════════════════════════════ */

/* ── 变量 ── */
:root {
  --bg: #f6faf6;
  --panel: #ffffff;
  --text: #1e2a22;
  --muted: #6a786f;
  --line: #dbe8dd;
  --soft: #edf6ef;
  --accent: #6c8d71;
  --accent-strong: #4d6a53;
  --shadow: 0 16px 40px rgba(47, 73, 55, 0.08);
  --radius: 22px;
}

/* ── 基础重置 ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top left, #f8fff8 0, #f6faf6 36%, #f2f7f3 100%);
  color: var(--text);
  min-height: 100vh;
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

h1, h2, h3, p { margin: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.muted { color: var(--muted); font-size: 14px; }

/* ── 屏幕切换 ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── 按钮 ── */
button, .btn {
  border: 0;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  font: inherit;
}
button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }

.btn-primary {
  background: var(--accent-strong);
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(77, 106, 83, 0.18);
  font-weight: 700;
  display: inline-block;
  text-decoration: none;
}

.btn-secondary {
  background: #fff;
  color: var(--accent-strong);
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 700;
}

.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ═══════════════════════════════
   首页
   ═══════════════════════════════ */
.home-header {
  padding: 36px 28px 24px;
  margin-top: 20px;
  position: relative;
  overflow: hidden;
}
.home-header::after {
  content: "";
  position: absolute;
  right: -60px; top: -60px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(127,165,134,0.18), rgba(127,165,134,0.02));
  pointer-events: none;
}
.home-header h1 {
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.home-header .sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.home-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ── 场景卡片 ── */
.scene-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.scene-card {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform .16s ease, box-shadow .16s ease;
}
.scene-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(47, 73, 55, 0.12);
}

.scene-card-icon {
  font-size: 32px;
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.scene-card-body h3 {
  font-size: 17px;
  margin-bottom: 4px;
}
.scene-card-body p {
  font-size: 13px;
  color: var(--muted);
}

.scene-card-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 600;
}

.scene-card-arrow {
  color: var(--muted);
  font-size: 18px;
}

/* ── 首页档案摘要 ── */
.home-profile-box {
  margin-top: 18px;
  padding: 20px;
}
.home-profile-box h3 {
  font-size: 15px;
  margin-bottom: 12px;
}
.profile-mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  margin: 4px 4px 4px 0;
  font-size: 13px;
}
.profile-mini-tag strong { color: var(--accent-strong); }

/* ═══════════════════════════════
   场景介绍页
   ═══════════════════════════════ */
.intro-wrap {
  margin-top: 20px;
  padding: 36px 28px;
  text-align: center;
}
.intro-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.intro-wrap h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.intro-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin-top: 10px;
}

.intro-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.intro-meta-item {
  text-align: center;
}
.intro-meta-item .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}
.intro-meta-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.dim-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 24px;
  text-align: left;
}
.dim-preview-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #fbfdfb);
}
.dim-preview-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dim-preview-range {
  font-size: 12px;
  color: var(--muted);
}

.intro-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

/* ═══════════════════════════════
   答题页
   ═══════════════════════════════ */
.test-wrap {
  margin-top: 22px;
  padding: 22px;
}

.test-scene-title {
  font-size: 14px;
  color: var(--accent-strong);
  margin-bottom: 12px;
  font-weight: 600;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.progress {
  flex: 1;
  min-width: 240px;
  height: 10px;
  background: #edf3ee;
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #97b59c, #5b7a62);
  border-radius: inherit;
  transition: width .22s ease;
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.question-list { display: grid; gap: 16px; min-height: 260px; }

.question {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdfb);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.question-title {
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.options { display: grid; gap: 10px; margin-top: 14px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.option:hover {
  border-color: #bcd0c1;
  background: #f8fcf9;
}
.option input {
  margin-top: 3px;
  accent-color: var(--accent-strong);
  transform: scale(1.1);
  flex-shrink: 0;
}
.option-code {
  font-weight: 800;
  color: var(--accent-strong);
  min-width: 22px;
}

.actions-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 6px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ── 单题模式 ── */
.question-single {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.question-single.question-visible {
  opacity: 1;
  transform: translateY(0);
}

.question-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

/* ═══════════════════════════════
   结果页
   ═══════════════════════════════ */
.result-wrap {
  margin-top: 22px;
  padding: 22px;
}

.result-scene-title {
  font-size: 14px;
  color: var(--accent-strong);
  margin-bottom: 16px;
  font-weight: 600;
}

.result-layout { display: grid; gap: 18px; }

.result-top {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  align-items: stretch;
}

.poster-box, .type-box, .analysis-box, .dim-box, .note-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdfb);
}

.poster-box {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 280px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(127,165,134,0.16), rgba(127,165,134,0) 40%),
    linear-gradient(180deg, #ffffff, #f7fbf8);
}
.poster-box::after {
  content: "";
  position: absolute;
  right: -46px; bottom: -46px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(127,165,134,0.12), rgba(127,165,134,0.01));
  pointer-events: none;
}
.poster-image {
  width: 100%;
  min-height: 220px;
  max-height: 460px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255,255,255,0.75);
  position: relative;
  z-index: 1;
}
.poster-box.no-image .poster-image { display: none; }
.poster-box.no-image {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-caption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

.type-kicker {
  font-size: 12px;
  color: var(--accent-strong);
  margin-bottom: 8px;
  letter-spacing: .06em;
}
.type-name {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.type-subname {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.match {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}

.analysis-box h3, .dim-box h3, .note-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}
.analysis-box p {
  margin: 0;
  color: #304034;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.note-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

/* ── 维度列表 ── */
.dim-list { display: grid; gap: 12px; }
.dim-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.dim-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.dim-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.dim-item-score {
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.dim-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

/* ── 作者栏 ── */
.author-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdfb);
  overflow: hidden;
}
.author-box summary {
  list-style: none;
  cursor: pointer;
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.author-box summary::-webkit-details-marker { display: none; }
.author-box summary::after {
  content: '展开';
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 6px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.author-box[open] summary::after { content: '收起'; }
.author-content {
  border-top: 1px solid var(--line);
  padding: 0 18px 18px;
}
.author-content p {
  margin: 14px 0 0;
  color: #304034;
  font-size: 14px;
  line-height: 1.9;
}

/* ── 结果操作按钮 ── */
.result-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* ═══════════════════════════════
   人格档案页
   ═══════════════════════════════ */
.profile-wrap {
  margin-top: 20px;
  padding: 28px;
}
.profile-wrap h2 {
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.profile-card {
  padding: 20px;
}
.profile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.profile-scene-name {
  font-size: 12px;
  color: var(--accent-strong);
  font-weight: 600;
}
.profile-date {
  font-size: 12px;
  color: var(--muted);
}
.profile-persona-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.profile-similarity {
  font-size: 13px;
  color: var(--accent-strong);
  margin-bottom: 14px;
}

.profile-summary {
  margin-top: 18px;
  padding: 20px;
}
.profile-summary h3 {
  font-size: 16px;
  margin-bottom: 10px;
}
.profile-summary p {
  color: #304034;
  font-size: 15px;
  line-height: 1.8;
}

.profile-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
}

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── 页脚 ── */
.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

/* ═══════════════════════════════
   响应式
   ═══════════════════════════════ */
@media (max-width: 860px) {
  .result-top { grid-template-columns: 1fr; }
  .scene-card { grid-template-columns: 48px 1fr auto; }
  .scene-card-arrow { display: none; }
}

@media (max-width: 600px) {
  .shell { padding: 14px 12px 42px; }
  .home-header, .intro-wrap { padding: 20px 16px; }
  .home-header h1, .intro-wrap h1 { font-size: 28px; }
  .test-wrap, .result-wrap { padding: 16px; }
  .question-title { font-size: 15px; }
  .dim-preview { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .timeline { padding-left: 16px; }
}

/* ═══════════════════════════════
   暗色模式
   ═══════════════════════════════ */
[data-theme="dark"] {
  --bg: #1a1f1c;
  --panel: #242a26;
  --text: #e0e8e2;
  --muted: #8a9a8e;
  --line: #364038;
  --soft: #2a322c;
  --accent: #7fa586;
  --accent-strong: #9cc4a4;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] body {
  background: radial-gradient(circle at top left, #1e2620 0, #1a1f1c 36%, #161b18 100%);
}
[data-theme="dark"] .btn-secondary {
  background: var(--panel);
  color: var(--accent-strong);
}
[data-theme="dark"] .btn-primary {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .home-header::after {
  background: linear-gradient(180deg, rgba(127,165,134,0.08), rgba(127,165,134,0.01));
}
[data-theme="dark"] .question {
  background: linear-gradient(180deg, #2a322c, #262e28);
}
[data-theme="dark"] .option {
  background: var(--panel);
}
[data-theme="dark"] img {
  opacity: 0.92;
}

#themeToggle {
  font-size: 16px;
  padding: 6px 12px;
  line-height: 1;
  border-radius: 10px;
}

/* ═══════════════════════════════
   页面转场动画
   ═══════════════════════════════ */
.screen {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.screen.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════
   答题交互反馈
   ═══════════════════════════════ */
.option {
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.option.selected {
  border-color: var(--accent-strong);
  background: var(--soft);
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(77, 106, 83, 0.12);
}
[data-theme="dark"] .option.selected {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════
   结果页动画
   ═══════════════════════════════ */
.type-name, .match, .type-kicker {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.type-kicker { transition-delay: 0.1s; }
.type-name { transition-delay: 0.25s; }
.match { transition-delay: 0.4s; }
.result-loaded .type-name,
.result-loaded .match,
.result-loaded .type-kicker {
  opacity: 1;
  transform: translateY(0);
}

.dim-bar {
  height: 6px;
  background: var(--soft);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}
.dim-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ═══════════════════════════════
   分享 Loading Modal
   ═══════════════════════════════ */
.share-loading-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(30, 42, 34, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-loading-content {
  text-align: center;
  color: #fff;
}
.share-loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════
   首页卡片动效
   ═══════════════════════════════ */
.scene-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.scene-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(47, 73, 55, 0.12);
}
[data-theme="dark"] .scene-card:hover {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3);
}
.scene-card-icon {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.scene-card:hover .scene-card-icon {
  transform: scale(1.15) rotate(-5deg);
}
.scene-card-arrow {
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.5;
}
.scene-card:hover .scene-card-arrow {
  transform: translateX(4px);
  opacity: 1;
}

/* ═══════════════════════════════
   档案页时间线
   ═══════════════════════════════ */
.profile-scene-group {
  margin-bottom: 28px;
}
.profile-scene-group h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text);
}
.timeline {
  position: relative;
  padding-left: 22px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}
.timeline-item {
  position: relative;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
}
.timeline-item.latest::before {
  background: var(--accent-strong);
  width: 10px;
  height: 10px;
  left: -21px;
}
.timeline-date { color: var(--muted); min-width: 42px; }
.timeline-persona { font-weight: 600; }
.timeline-similarity { color: var(--muted); font-size: 13px; }
.timeline-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-strong);
}
.profile-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
