/* 群友软件画像与配对 — 视觉 */
:root {
  --paper: #f7f5f0;
  --card: #ffffff;
  --ink: #1a1814;
  --muted: #6b6560;
  --line: #e6e1d8;
  --accent: #ff5c35;
  --accent-soft: #ffe8e0;
  --lime: #c8f135;
  --violet: #6c5ce7;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(26, 24, 20, 0.08);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #ebe7df;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100%;
}

button,
input {
  font-family: inherit;
}

#app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  box-shadow: 0 0 0 1px rgba(26, 24, 20, 0.04);
  overflow-x: hidden;
}

/* ---------- 顶栏进度 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(12px);
  padding: 8px 14px 8px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.progress-text {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.btn-ghost {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 6px;
  cursor: pointer;
}

.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ---------- 页面容器 ---------- */
.screen {
  padding: 4px 14px 20px;
  animation: fadeUp 0.28s ease;
}

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

.kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: none;
  margin-bottom: 8px;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 4px;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

/* ---------- 欢迎页 ---------- */
.welcome-screen {
  min-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.welcome-hero {
  margin-bottom: 18px;
}

.welcome-hero h1 {
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.welcome-tagline {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

.welcome-screen .privacy-note {
  margin: 0 0 16px;
  font-size: 12px;
  padding: 10px;
}

.welcome-screen .btn-primary {
  padding: 14px 18px;
  font-size: 16px;
}

.hero-card {
  background: var(--card);
  border-radius: 24px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
}

.badge.lime {
  background: var(--lime);
  color: var(--ink);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.feature-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}

.feature-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex-shrink: 0;
}

.privacy-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 16px 0 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  border: 1px dashed var(--line);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 92, 53, 0.28);
}

.btn-secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-violet {
  background: var(--violet);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-row .btn {
  flex: 1;
}

/* ---------- 搜索与选项 ---------- */
.search-wrap {
  margin: 4px 0 8px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  min-height: 46px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  user-select: none;
}

.option:active {
  transform: scale(0.98);
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option.disabled {
  opacity: 0.38;
  pointer-events: none;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.option-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-all;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.limit-hint {
  color: var(--accent);
  font-weight: 600;
}

.other-box {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.selected-others {
  margin-top: 12px;
}

.selected-others-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.selected-others-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-other-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.chip-remove {
  border: none;
  background: rgba(255, 92, 53, 0.15);
  color: var(--accent);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.other-box label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.other-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

/* ---------- 身份 / 预览 ---------- */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.field input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 16px;
  outline: none;
  background: var(--card);
}

.field input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  overflow: hidden;
  border: 2px solid var(--line);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.summary-item .q {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-item .a {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-mini {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
}

/* ---------- 结果页 ---------- */
.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.persona-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}

.persona-desc {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

.quip {
  font-size: 15px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.tag.accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.tag.lime {
  background: var(--lime);
  border-color: transparent;
}

.radar-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.radar-wrap svg {
  width: 100%;
  max-width: 300px;
  height: auto;
}

.comp-group {
  margin-bottom: 12px;
}

.comp-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.comp-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comp-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
}

.comp-item .mini-swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.comp-item.rare {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(200, 241, 53, 0.35);
}

.rare-flag {
  background: var(--lime);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 2px;
}

/* CP cards */
.cp-card {
  border: 2px solid var(--violet);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, #fff 0%, #f4f1ff 100%);
  margin-bottom: 14px;
}

.cp-score {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--violet);
  line-height: 1;
}

.cp-score span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}

.cp-name {
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 4px;
}

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

.match-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.match-person .avatar-preview {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.match-row .score {
  font-weight: 700;
  color: var(--violet);
  font-size: 15px;
}

.pool-banner {
  background: var(--ink);
  color: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 14px;
}

.pool-banner strong {
  color: var(--lime);
}

/* 分享 */
.share-preview {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  display: block;
  background: var(--paper);
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.qr-box svg {
  width: 160px;
  height: 160px;
  border-radius: 8px;
}

.share-link {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  text-align: center;
}

/* loading */
.loading-box {
  text-align: center;
  padding: 48px 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0 28px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

@media (min-width: 700px) {
  body {
    padding: 12px 0;
    font-size: 15px;
  }

  #app {
    width: min(100%, 560px);
    min-height: calc(100vh - 24px);
    border-radius: 18px;
    overflow: hidden;
  }

  .option {
    min-height: 44px;
  }
}

@media (max-height: 720px) {
  .screen {
    padding-bottom: 12px;
  }

  .welcome-hero {
    margin-bottom: 12px;
  }

  .welcome-hero h1 {
    font-size: 28px;
  }

  .option {
    min-height: 42px;
    padding: 6px 8px;
  }

  .other-box {
    padding: 6px 8px;
  }

  .btn {
    padding: 11px 14px;
  }
}
