/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --surface: rgba(0,0,0,.02);
  --surface-hover: rgba(0,0,0,.05);
  --border: rgba(0,0,0,.08);
  --text: #2d3748;
  --text-muted: rgba(0,0,0,.45);
  --accent: #4a8b6f;
  --accent2: #2b6d4f;
  --accent-light: rgba(74,139,111,.08);
  --accent-border: rgba(74,139,111,.15);
  --glow: 0 2px 12px rgba(74,139,111,.12);
  --radius: 16px;
  --radius-sm: 12px;
}

html { scroll-behavior: smooth; }

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

#bgCanvas {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0;
  display: none;
}

/* ===== LAYOUT ===== */
.shell {
  position: relative; z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.screen { display: none; }
.screen.active { display: block; animation: fadeUp .5s ease both; }

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

/* ===== GLASS CARD ===== */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== BUTTONS ===== */
button {
  border: 0; cursor: pointer; font: inherit;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
@media (hover: hover) {
  button:hover:not(:disabled) { transform: translateY(-1px); }
}
button:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.btn-glow {
  background: var(--accent);
  color: #fff; font-weight: 700;
  padding: 16px 32px;
  border-radius: 999px;
  box-shadow: var(--glow);
  font-size: 16px;
  letter-spacing: .02em;
}
.btn-glow:hover { box-shadow: 0 2px 20px rgba(74,139,111,.2); background: var(--accent2); }

/* Mode picker */
.mode-picker {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 4px;
}
.btn-mode {
  padding: 14px 24px; font-size: 15px; min-width: 140px;
}
.btn-mode-full {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: none;
}
.btn-mode-full:hover {
  background: var(--accent); color: #fff;
  box-shadow: var(--glow);
}
.mode-hint {
  font-size: 12px; color: var(--muted); margin-top: 10px; opacity: 0.7;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.btn-ghost:hover { background: var(--surface-hover); }

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

/* ===== INTRO ===== */
.intro-wrap {
  min-height: 85vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 24px;
}

.logo-ring {
  position: relative; width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-spin { animation: ringRotate 6s linear infinite; transform-origin: center; }
@keyframes ringRotate { to { transform: rotate(360deg); } }
.logo-text {
  font-size: 28px; font-weight: 900; letter-spacing: .1em;
  color: var(--accent);
}

.intro-title {
  font-size: clamp(32px, 7vw, 56px);
  line-height: 1.12; font-weight: 800;
  letter-spacing: -.03em;
}
.gradient-text {
  color: var(--accent);
}
.intro-sub {
  color: var(--text-muted); font-size: 15px;
  letter-spacing: .04em;
}

/* ===== TEST HEADER ===== */
.test-header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; margin-bottom: 8px;
}

.progress-ring-wrap {
  position: relative; width: 48px; height: 48px;
  flex-shrink: 0;
}
.progress-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--accent);
}
.progress-label { flex: 1; color: var(--text-muted); font-size: 14px; }

/* ===== QUESTION CARD ===== */
.question-stage { perspective: 800px; }

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: opacity .35s, transform .35s;
}
.q-card.exit-left  { opacity: 0; transform: translateX(-60px); }
.q-card.exit-right { opacity: 0; transform: translateX(60px); }
.q-card.enter { opacity: 0; transform: translateX(40px); }

.q-dim-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
  letter-spacing: .04em;
}

.q-text {
  font-size: 17px; line-height: 1.75;
  white-space: pre-wrap;
  margin-bottom: 20px;
}

.q-options { display: grid; gap: 10px; }

.q-opt {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.01);
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  min-height: 48px;
}
@media (hover: hover) {
  .q-opt:hover { background: rgba(74,139,111,.04); border-color: var(--accent-border); }
}
.q-opt.selected {
  background: var(--accent-light);
  border-color: rgba(74,139,111,.35);
}
.q-opt.selected .q-opt-code { color: #fff; background: var(--accent); }
.q-opt:active { transform: scale(.97); background: rgba(0,0,0,.04); }

.q-opt-code {
  flex-shrink: 0; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(0,0,0,.04);
  font-size: 13px; font-weight: 800;
  color: var(--text-muted);
  transition: background .18s, color .18s;
}

.q-opt-label { font-size: 15px; line-height: 1.65; padding-top: 2px; }

/* ===== TEST NAV ===== */
.test-nav {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 20px; flex-wrap: wrap;
}

/* ===== RESULT ===== */
.result-wrap { display: grid; gap: 20px; }

.result-hero-section {
  text-align: center;
  padding: 40px 20px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-kicker {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}

.result-type-img-wrap {
  margin: 0 auto 16px;
  max-width: 200px;
}
.result-type-img {
  width: 100%; height: auto;
  display: block;
  border-radius: 12px;
}

.result-type-name {
  font-size: clamp(36px, 8vw, 56px);
  line-height: 1.08; font-weight: 900;
  letter-spacing: -.03em;
  color: var(--accent);
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.result-rarity {
  margin-top: 10px;
  font-size: 14px; font-weight: 600;
  color: #d4a017;
  letter-spacing: .02em;
}

.result-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 8px 16px;
  border-radius: 999px;
}

.result-sub {
  margin-top: 14px;
  color: var(--text-muted); font-size: 14px;
  line-height: 1.7; max-width: 480px; margin-inline: auto;
}

/* Result cards */
.result-intro-card,
.result-desc-card,
.result-radar-card,
.result-dims-card,
.result-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.result-intro-card p {
  font-size: 18px; line-height: 1.8;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.result-desc-card h3,
.result-radar-card h3,
.result-dims-card h3,
.result-note-card h3 {
  font-size: 16px; margin-bottom: 14px;
  color: var(--accent);
}

.result-desc-card p {
  font-size: 15px; line-height: 1.9;
  color: var(--text-muted);
}

/* Radar */
.radar-note {
  text-align: center; font-size: 12px;
  color: var(--text-muted); margin-bottom: 8px;
}
.radar-container {
  display: flex; justify-content: center;
  padding: 10px 0;
}
#radarCanvas {
  max-width: 100%; height: auto;
}

/* Dim list */
.dim-list { display: grid; gap: 10px; }
.dim-item {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.01);
}
.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; }
.dim-item-score {
  font-size: 13px; font-weight: 800;
  color: var(--accent); white-space: nowrap;
}
.dim-item p {
  color: var(--text-muted); font-size: 13px; line-height: 1.8;
}

/* Note */
.result-note-card p {
  color: var(--text-muted); font-size: 13px; line-height: 1.8;
}

/* QR code */
.result-qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.result-qr-card h3 {
  font-size: 16px; margin-bottom: 14px;
  color: var(--accent);
}
.qr-container {
  display: inline-block;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
}
.qr-container canvas { display: block; }
.qr-container { background: #f5f5f5; }
.qr-url {
  margin-top: 10px;
  color: var(--text-muted); font-size: 13px;
  letter-spacing: .03em;
}

/* Author */
.author-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.author-card summary {
  list-style: none; cursor: pointer;
  padding: 20px 24px;
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.author-card summary::-webkit-details-marker { display: none; }
.author-card summary::after {
  content: '展开'; font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 5px 10px; border-radius: 999px;
}
.author-card[open] summary::after { content: '收起'; }
.author-content {
  border-top: 1px solid var(--border);
  padding: 0 24px 20px;
}
.author-content p {
  margin-top: 14px;
  color: var(--text-muted); font-size: 14px; line-height: 1.9;
}

/* Result actions */
.result-actions {
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap; padding-top: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .shell { padding: 14px 12px 48px; }
  .q-card { padding: 20px 16px; }
  .q-text { font-size: 16px; }
  .q-opt { padding: 14px; gap: 12px; }
  .q-opt-label { font-size: 14px; }
  .btn-glow { padding: 14px 28px; font-size: 15px; }
  .btn-ghost { padding: 12px 18px; }
  .test-nav { gap: 8px; padding: 0 4px; }
  .result-hero-section { padding: 28px 16px 24px; }
  .result-intro-card,
  .result-desc-card,
  .result-radar-card,
  .result-dims-card,
  .result-note-card { padding: 18px; }
  .radar-container canvas { max-width: 320px; }
}

/* ===== PARTICLES ===== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ===== SHARE SECTION ===== */
.result-share-section {
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.result-share-section h3 {
  font-size: 16px; margin-bottom: 8px;
  color: var(--accent);
}
.share-hint {
  color: var(--text-muted); font-size: 13px;
  margin-bottom: 16px; line-height: 1.6;
}
.share-actions {
  display: flex; gap: 10px;
  justify-content: center; flex-wrap: wrap;
}
.btn-share { font-size: 14px; }
.share-toast {
  margin-top: 12px; font-size: 13px;
  color: #4a8b6f; opacity: 0;
  transition: opacity .3s;
}
.share-toast.show {
  opacity: 1;
  animation: toastLife 2.5s ease forwards;
}
@keyframes toastLife {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
.share-retip {
  margin-top: 14px; font-size: 12px;
  color: var(--text-muted); opacity: .7;
}
.result-watermark {
  margin-top: 16px; font-size: 12px;
  color: rgba(0,0,0,.12);
  letter-spacing: .08em;
}

/* ===== SHARE OVERLAY ===== */
.share-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.share-overlay-inner {
  max-width: 380px; width: 100%; text-align: center;
}
.share-overlay-hint {
  color: rgba(255,255,255,.6); font-size: 14px;
  margin-bottom: 16px; line-height: 1.7;
}
.share-overlay-img {
  width: 100%; border-radius: 12px;
  box-shadow: 0 2px 20px rgba(0,0,0,.15);
  -webkit-touch-callout: default;
}
.share-overlay-close { margin-top: 20px; }

/* ===== NICKNAME PROMPT ===== */
.mode-incentive {
  font-size: 13px; color: var(--text-muted); margin-top: 4px;
  line-height: 1.5;
}

.nickname-prompt {
  width: 100%; max-width: 320px;
  margin-top: 8px;
}
.nickname-label {
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 10px;
}
.nickname-row {
  display: flex; gap: 8px; align-items: center;
}
.nickname-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.nickname-input:focus {
  border-color: var(--accent);
}
.nickname-save {
  padding: 10px 18px; font-size: 14px;
}
.nickname-display {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-size: 14px; color: var(--text-muted);
}
.nickname-display span {
  color: var(--accent); font-weight: 600;
}
.nickname-edit {
  background: none; border: none; padding: 2px 4px;
  font-size: 14px; cursor: pointer; opacity: .5;
}
.nickname-edit:hover { opacity: 1; }

/* ===== COLLECTION TRACKER ===== */
.collection-tracker {
  width: 100%; max-width: 280px; margin-top: 8px;
}
.collection-bar-wrap {
  height: 6px; background: var(--surface); border-radius: 3px;
  overflow: hidden; border: 1px solid var(--border);
}
.collection-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width .6s ease;
}
.collection-label {
  font-size: 13px; color: var(--text-muted); margin-top: 6px;
  letter-spacing: .02em;
}

/* ===== CHALLENGE BANNER ===== */
.challenge-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-top: 4px;
  font-size: 14px; line-height: 1.6;
  color: var(--text);
}
.challenge-banner .challenge-type {
  font-weight: 700; color: var(--accent);
}
.challenge-banner .challenge-cta {
  display: block; margin-top: 4px; font-size: 13px;
  color: var(--text-muted);
}

/* ===== HISTORY LOG ===== */
.history-log {
  width: 100%; max-width: 320px; margin-top: 12px;
}
.history-title {
  font-size: 12px; color: var(--text-muted); margin-bottom: 8px;
  letter-spacing: .04em; text-transform: uppercase;
}
.history-list {
  display: flex; flex-direction: column; gap: 6px;
}
.history-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px;
}
.history-item-type {
  font-weight: 700; color: var(--accent); white-space: nowrap;
}
.history-item-cn {
  flex: 1; color: var(--text); font-weight: 500;
}
.history-item-time {
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}

/* ===== GOLD BUTTON ===== */
.btn-gold {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  color: #fff; font-weight: 700;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px;
  box-shadow: 0 2px 12px rgba(212,160,23,.25);
  margin-top: 10px;
}
.btn-gold:hover {
  background: linear-gradient(135deg, #e6b422, #d4a017);
  box-shadow: 0 2px 20px rgba(212,160,23,.35);
}

/* ===== MODE CROSS-SELL (result page) ===== */
.mode-cross-sell {
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 12px;
  text-align: center;
  font-size: 14px; line-height: 1.6;
  color: var(--text);
}
.mode-cross-sell .mcs-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff; font-weight: 700; font-size: 13px;
  border-radius: 999px; border: none; cursor: pointer;
}
.mode-cross-sell .mcs-cta:hover { background: var(--accent2); }
.mode-cross-sell.mcs-gold {
  background: rgba(212,160,23,0.06);
  border-color: rgba(212,160,23,0.2);
}

/* ===== UNLOCK BANNER ===== */
.unlock-banner {
  background: linear-gradient(135deg, rgba(212,160,23,0.08), rgba(212,160,23,0.02));
  border: 1.5px solid rgba(212,160,23,0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 14px;
  text-align: center;
}
.unlock-title {
  font-size: 18px; font-weight: 800; margin-bottom: 4px;
}
.unlock-desc {
  font-size: 14px; color: var(--text-muted); line-height: 1.5;
}
.unlock-animate {
  animation: unlockPulse 1.5s ease 2;
}
@keyframes unlockPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 0 24px rgba(212,160,23,.2); }
}

/* ===== TYPE PICKER MODAL ===== */
.tp-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.tp-modal-inner {
  background: #fff; border-radius: var(--radius);
  max-width: 480px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 24px 20px;
}
.tp-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.tp-modal-header h3 {
  font-size: 18px; font-weight: 800;
}
.tp-close {
  background: none; border: none; font-size: 20px;
  color: var(--text-muted); padding: 4px 8px;
}
.tp-hint {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
}

.next-quiz-cta {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  background: var(--accent-light);
}
.next-quiz-cta-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.next-quiz-cta-btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}
.next-quiz-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.next-quiz-link {
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
}
.next-quiz-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

.quiz-cross-footer {
  margin-top: 18px;
  text-align: center;
  padding: 14px 8px 4px;
}
.quiz-cross-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.quiz-cross-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.quiz-cross-link {
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}
.quiz-cross-link.is-active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-light);
}

.tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.tp-item {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px 8px; gap: 4px;
  cursor: pointer; transition: all .15s;
}
.tp-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
}
.tp-img {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 8px;
}
.tp-code {
  font-size: 11px; font-weight: 800; color: var(--accent);
  letter-spacing: .02em;
}
.tp-cn {
  font-size: 11px; color: var(--text-muted);
}
