/* ============================================
   MBTI Test — Cute Cartoon Style
   Xiaohongshu Mini-Tool
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #FF8FA3;
  --pink-light: #FFD6E0;
  --pink-bg: #FFF0F3;
  --lavender: #C084FC;
  --lavender-light: #E9D5FF;
  --sky: #67E8F9;
  --sky-light: #CFFAFE;
  --mint: #6EE7B7;
  --mint-light: #D1FAE5;
  --peach: #FCD34D;
  --peach-light: #FEF3C7;
  --card: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-lighter: #B2BEC3;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xl: 28px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--pink-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* ---------- App Container ---------- */
#app {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  position: relative;
}

/* ---------- Fade / Slide Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.08); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes progressFill {
  from { width: 0%; }
}

.screen {
  display: none;
  animation: fadeIn 0.5s var(--bounce);
}
.screen.active {
  display: block;
}

/* ---------- Welcome Screen ---------- */
.welcome {
  text-align: center;
  padding: 40px 0 20px;
}

.welcome-icon {
  font-size: 80px;
  animation: float 3s ease-in-out infinite;
  display: block;
  margin-bottom: 16px;
}

.welcome h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.welcome .subtitle {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.welcome .desc {
  font-size: 14px;
  color: var(--text-lighter);
  margin-bottom: 32px;
  line-height: 1.8;
}

/* ---------- Cute Decoration ---------- */
.deco-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 24px;
  margin-bottom: 20px;
  animation: fadeInUp 0.8s var(--bounce);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 143, 163, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 25px rgba(255, 143, 163, 0.5);
}
.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--pink-light);
  box-shadow: var(--shadow);
}
.btn-secondary:hover {
  border-color: var(--pink);
  transform: translateY(-2px);
}

.btn-small {
  padding: 10px 24px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

/* ---------- Question Screen ---------- */
.quiz-branding {
  text-align: center;
  padding: 20px 0 8px;
}

.quiz-brand-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 4px;
  animation: float 3s ease-in-out infinite;
}

.quiz-brand-title {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.progress-wrap {
  margin-bottom: 24px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.progress-info .q-num {
  font-weight: 700;
  color: var(--pink);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--pink-light);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--lavender));
  border-radius: 99px;
  transition: width 0.5s var(--bounce);
}

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  animation: slideInRight 0.5s var(--bounce);
}

.question-dim {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.dim-EI { background: #E0F7FA; color: #00838F; }
.dim-SN { background: #FFF3E0; color: #E65100; }
.dim-TF { background: #F3E5F5; color: #7B1FA2; }
.dim-JP { background: #E8F5E9; color: #2E7D32; }

.question-text {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--text);
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #F0F0F0;
  border-radius: var(--radius-sm);
  background: #FAFAFA;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}

.option-btn:hover {
  border-color: var(--pink);
  background: var(--pink-bg);
  transform: translateX(4px);
}

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

.option-btn .opt-icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* ---------- Loading Screen ---------- */
.loading {
  text-align: center;
  padding: 80px 0;
}

.loading-icon {
  font-size: 60px;
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
}

.loading-bar {
  width: 200px;
  height: 6px;
  background: var(--pink-light);
  border-radius: 99px;
  margin: 16px auto 0;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--pink), var(--lavender));
  border-radius: 99px;
  animation: loadingMove 1.5s ease-in-out infinite;
}

@keyframes loadingMove {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ---------- Result Screen ---------- */
.result-wrap {
  animation: fadeInUp 0.6s var(--bounce);
}

.result-header {
  text-align: center;
  padding: 20px 0 24px;
}

.result-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.result-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 12px;
  animation: bounceIn 0.8s var(--bounce);
}

.result-type {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.result-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.result-subtitle {
  font-size: 14px;
  color: var(--text-light);
}

.result-population {
  font-size: 13px;
  color: var(--text-lighter);
  margin-top: 4px;
  padding: 4px 14px;
  background: #F8F8F8;
  border-radius: 99px;
  display: inline-block;
}

/* Dimension Score Bars */
.dim-scores {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.dim-score-item {
  margin-bottom: 14px;
}
.dim-score-item:last-child { margin-bottom: 0; }

.dim-score-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dim-score-bar-bg {
  height: 6px;
  background: #F0F0F0;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
}

.dim-score-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s var(--bounce);
}

.dim-score-left, .dim-score-right {
  font-size: 11px;
  color: var(--text-lighter);
  font-weight: 500;
}
.dim-score-left.dim-active { color: var(--text); font-weight: 700; }
.dim-score-right.dim-active { color: var(--text); font-weight: 700; }

/* Result Detail Card */
.result-detail {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.result-detail h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-detail p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-light);
  margin-bottom: 16px;
}

/* Trait Tags */
.trait-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  background: var(--pink-light);
  color: var(--pink);
}

/* Lists in result */
.list-slim {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}
.list-slim li {
  font-size: 14px;
  color: var(--text-light);
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
  line-height: 1.5;
}
.list-slim li::before {
  content: '✨';
  position: absolute;
  left: 0;
}
.list-slim.weakness li::before {
  content: '🌱';
}

/* Compatibility */
.compat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.compat-tag {
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

/* Share Section */
.share-section {
  text-align: center;
  padding: 20px 0 10px;
}

.share-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.share-section p {
  font-size: 13px;
  color: var(--text-lighter);
  margin-bottom: 16px;
}

.share-card-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  display: block;
}

.btn-share-xhs {
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #FF2442, #FF6B81);
  box-shadow: 0 4px 15px rgba(255, 36, 66, 0.4);
}
.btn-share-xhs:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 25px rgba(255, 36, 66, 0.5);
}
.btn-share-xhs:active {
  transform: scale(0.97);
}

.share-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--card);
  border-radius: 99px;
  font-size: 13px;
  color: var(--text-light);
  box-shadow: var(--shadow);
  margin-top: 8px;
}

/* ---------- Retake Button ---------- */
.retake-area {
  text-align: center;
  padding: 8px 0 calc(20px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Responsive ---------- */
@media (max-width: 420px) {
  #app { padding: 16px 12px 30px; }
  .welcome h1 { font-size: 24px; }
  .quiz-brand-icon { font-size: 30px; }
  .quiz-brand-title { font-size: 16px; }
  .question-text { font-size: 17px; }
  .result-type { font-size: 36px; }
}

/* ---------- Paywall (USDT/USDC unlock) ---------- */
.detail-lock {
  position: relative;
  border-radius: var(--radius);
}
.detail-lock.is-locked .result-detail {
  filter: blur(7px);
  -webkit-filter: blur(7px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
/* The full report is empty until the backend releases it after payment, so the
   locked zone needs a min-height for the paywall overlay card to sit properly. */
.detail-lock.is-locked {
  min-height: 440px;
}
.paywall {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 5;
}
.detail-lock:not(.is-locked) .paywall { display: none; }

.paywall-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(2px);
  border: 2px solid var(--pink-light);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(255, 143, 163, 0.35);
  padding: 22px 20px;
  text-align: center;
  animation: paywallIn 0.4s var(--bounce);
}
@keyframes paywallIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.paywall-icon { font-size: 38px; margin-bottom: 4px; }
.paywall-card h3 { font-size: 19px; color: var(--text); margin-bottom: 6px; }
.paywall-sub { font-size: 13px; color: var(--text-light); line-height: 1.5; margin-bottom: 14px; }

.paywall-price {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 14px;
}
.paywall-price .price-usd {
  font-size: 13px;
  color: var(--text-lighter);
  text-decoration: line-through;
  text-decoration-color: var(--text-lighter);
}
.paywall-price .price-crypto {
  font-size: 20px;
  font-weight: 800;
  color: #FF2442;
}
.paywall-price .price-crypto .or { color: var(--text-lighter); font-weight: 500; font-size: 15px; }

.paywall-opts {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.paywall-opts label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
  text-align: left;
}
.paywall-opts select {
  width: 100%;
  padding: 9px 10px;
  border: 2px solid #F0F0F0;
  border-radius: var(--radius-sm);
  background: #FAFAFA;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}
.paywall-opts select:focus { outline: none; border-color: var(--pink); }

.pay-status {
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 12px;
  min-height: 18px;
  line-height: 1.5;
  word-break: break-word;
}
.pay-status.pending { color: #F59E0B; }
.pay-status.ok { color: #16A34A; font-weight: 600; }
.pay-status.err { color: #EF4444; }
.pay-status.warn { color: #F59E0B; }

.paywall-note {
  font-size: 11px;
  color: var(--text-lighter);
  margin-top: 10px;
}
