/* ========================================
   MBTI 性格测试 — 少女怀春暗色主题
   基于 UI规范 设计令牌
   ======================================== */

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

:root {
  --void: #0c0d12;
  --abyss: #101118;
  --surface: #16171f;
  --elevated: #1e1f28;

  --coral: #E2685C;
  --coral-light: #F08070;
  --coral-deep: #B04840;
  --coral-soft: rgba(226, 104, 92, 0.08);
  --coral-glow: rgba(226, 104, 92, 0.22);

  --aurora: #8B7FE8;
  --aurora-light: #A99EF0;
  --aurora-soft: rgba(139, 127, 232, 0.12);
  --aurora-glow: rgba(139, 127, 232, 0.2);

  --silver: rgba(255, 255, 255, 0.92);
  --silver-muted: rgba(255, 255, 255, 0.55);
  --silver-ghost: rgba(255, 255, 255, 0.28);
  --silver-whisper: rgba(255, 255, 255, 0.1);

  --glass-bg: rgba(255, 255, 255, 0.025);
  --glass-border: rgba(255, 255, 255, 0.06);

  --expo: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 40px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Noto Sans SC', sans-serif;
  background: var(--void);
  color: var(--silver);
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* --- Stars Background --- */
.stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.2px 1.2px at 60% 20%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 80% 50%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1.5px 1.5px at 10% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 70% 90%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1.2px 1.2px at 90% 15%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,0.15), transparent),
    radial-gradient(ellipse 55% 40% at 50% 38%, rgba(255, 160, 180, 0.10) 0%, transparent 70%),
    radial-gradient(ellipse 120% 25% at 50% 25%, rgba(120, 140, 220, 0.06) 0%, rgba(160, 120, 200, 0.03) 50%, transparent 80%),
    radial-gradient(ellipse 50% 20% at 50% 100%, rgba(226, 104, 92, 0.08) 0%, transparent 50%);
  animation: skyBreathe 7s ease-in-out infinite alternate;
}

@keyframes skyBreathe {
  0% { filter: brightness(1) saturate(1); }
  100% { filter: brightness(1.08) saturate(1.1); }
}

/* --- Screens --- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--expo);
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 10;
}

/* ========================================
   Landing Page
   ======================================== */
.landing-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  animation: sceneEnter 1.2s var(--expo) both;
}

@keyframes sceneEnter {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-badge {
  display: inline-block;
  padding: 8px 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--coral-light);
  text-transform: uppercase;
  backdrop-filter: blur(20px);
  margin-bottom: 32px;
  animation: fadeIn 0.8s 0.3s both;
}

.hero-title {
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1.2;
  margin-bottom: 20px;
  animation: fadeIn 0.8s 0.5s both;
}

.gradient-text {
  background: linear-gradient(135deg, var(--coral) 0%, var(--aurora) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(16px, 3vw, 20px);
  color: var(--silver-muted);
  letter-spacing: 4px;
  margin-bottom: 48px;
  animation: fadeIn 0.8s 0.7s both;
}

.hero-hint {
  margin-top: 32px;
  font-size: 14px;
  color: var(--silver-ghost);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: fadeIn 0.8s 1.2s both;
}

.dot-live {
  width: 8px;
  height: 8px;
  background: #4ecb8a;
  border-radius: 50%;
  display: inline-block;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(78, 203, 138, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(78, 203, 138, 0); }
}

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

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--silver-ghost);
  border-bottom: 2px solid var(--silver-ghost);
  transform: rotate(45deg);
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50% { transform: rotate(45deg) translateY(8px); opacity: 0.8; }
}

/* ========================================
   Buttons
   ======================================== */
.btn-cta {
  display: inline-block;
  padding: 18px 56px;
  background: linear-gradient(135deg, #E8706A, #D45850);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s var(--spring), box-shadow 0.3s ease;
  animation: fadeIn 0.8s 0.9s both, btnBreath 3s ease-in-out 2s infinite;
}

.btn-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 48px rgba(226, 104, 92, 0.45);
}

.btn-cta:active {
  transform: translateY(0) scale(0.98);
}

@keyframes btnBreath {
  0%, 100% { box-shadow: 0 8px 32px rgba(226, 104, 92, 0.3); }
  50% { box-shadow: 0 12px 48px rgba(226, 104, 92, 0.5); }
}

.btn-ghost {
  display: inline-block;
  padding: 14px 40px;
  background: transparent;
  border: 1px solid var(--silver-whisper);
  border-radius: var(--radius-lg);
  color: var(--silver-muted);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-ghost:hover {
  border-color: var(--silver-ghost);
  color: var(--silver);
  background: var(--glass-bg);
}

.btn-back {
  background: none;
  border: none;
  color: var(--silver-ghost);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s;
}

.btn-back:hover { color: var(--silver); }
.btn-back.hidden { visibility: hidden; }

/* ========================================
   Test Page
   ======================================== */
.test-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  padding: 24px;
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.q-counter {
  font-size: 14px;
  color: var(--silver-ghost);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--silver-whisper);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--aurora));
  border-radius: 4px;
  transition: width 0.4s var(--expo);
}

.dimension-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--aurora-soft);
  border: 1px solid rgba(139, 127, 232, 0.15);
  border-radius: 100px;
  font-size: 13px;
  color: var(--aurora-light);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.question-card {
  transition: opacity 0.3s ease, transform 0.3s var(--expo);
}

.question-card.exit {
  opacity: 0;
  transform: translateX(-30px);
}

.question-card.enter {
  opacity: 0;
  transform: translateX(30px);
}

.question-text {
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 36px;
  min-height: 80px;
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--silver);
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--coral-glow);
  transform: translateX(4px);
}

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

.option-btn.selected {
  background: var(--coral-soft);
  border-color: var(--coral);
  box-shadow: 0 0 24px var(--coral-glow);
}

.option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--silver-whisper);
  font-size: 14px;
  font-weight: 600;
  color: var(--silver-muted);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.option-btn.selected .option-label {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}

.option-text {
  flex: 1;
}

/* ========================================
   Loading
   ======================================== */
.loading-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.loading-orb {
  width: 80px;
  height: 80px;
  margin: 0 auto 32px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--coral-light) 0%, var(--aurora) 60%, transparent 70%);
  animation: orbPulse 1.5s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 40px var(--coral-glow), 0 0 80px var(--aurora-glow);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 60px var(--coral-glow), 0 0 120px var(--aurora-glow);
    opacity: 1;
  }
}

.loading-text {
  font-size: 18px;
  color: var(--silver-muted);
  letter-spacing: 4px;
  animation: fadeIn 0.5s both;
}

/* ========================================
   Result Page
   ======================================== */
.result-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  padding: 24px;
  max-height: 100dvh;
  overflow-y: auto;
  scrollbar-width: none;
}

.result-container::-webkit-scrollbar { display: none; }

.result-header {
  text-align: center;
  margin-bottom: 28px;
  animation: sceneEnter 0.8s var(--expo) both;
}

.result-badge {
  font-size: 13px;
  color: var(--silver-ghost);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.result-type {
  font-size: clamp(56px, 15vw, 96px);
  font-weight: 700;
  letter-spacing: 8px;
  background: linear-gradient(135deg, var(--coral) 0%, var(--aurora) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: 8px;
}

.result-nickname {
  font-size: clamp(20px, 4vw, 28px);
  color: var(--silver);
  font-weight: 500;
  letter-spacing: 4px;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(40px);
  animation: fadeIn 0.6s var(--expo) both;
}

.glass-card:nth-child(2) { animation-delay: 0.1s; }
.glass-card:nth-child(3) { animation-delay: 0.2s; }
.glass-card:nth-child(4) { animation-delay: 0.3s; }

.glass-card h3 {
  font-size: 15px;
  color: var(--silver-muted);
  letter-spacing: 3px;
  margin-bottom: 16px;
  font-weight: 400;
}

.result-desc {
  font-size: 16px;
  line-height: 1.8;
  color: var(--silver);
}

/* Dimension bars */
.result-dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeIn 0.6s 0.15s both;
}

.dim-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  backdrop-filter: blur(20px);
}

.dim-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.dim-left { color: var(--silver-ghost); }
.dim-right { color: var(--silver-ghost); }
.dim-active { color: var(--coral-light); font-weight: 600; }

.dim-bar {
  height: 6px;
  background: var(--silver-whisper);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.dim-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--coral), var(--aurora));
  transition: width 1s var(--expo);
}

/* Traits */
.traits-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trait-tag {
  padding: 8px 18px;
  background: var(--coral-soft);
  border: 1px solid rgba(226, 104, 92, 0.12);
  border-radius: 100px;
  font-size: 14px;
  color: var(--coral-light);
  letter-spacing: 1px;
}

.trait-tag:nth-child(even) {
  background: var(--aurora-soft);
  border-color: rgba(139, 127, 232, 0.12);
  color: var(--aurora-light);
}

/* Famous */
.famous-list {
  font-size: 16px;
  line-height: 2;
  color: var(--silver-muted);
}

/* Actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 28px 0 20px;
  animation: fadeIn 0.6s 0.4s both;
}

.result-actions .btn-cta {
  animation: none;
  width: 100%;
}

.result-actions .btn-ghost {
  width: 100%;
  text-align: center;
}

.result-disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--silver-ghost);
  padding-bottom: 40px;
}

/* ========================================
   Toast
   ======================================== */
.toast {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  color: var(--silver);
  font-size: 14px;
  letter-spacing: 1px;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s var(--spring);
  backdrop-filter: blur(20px);
  pointer-events: none;
}

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

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
  .test-container, .result-container { padding: 16px; }
  .option-btn { padding: 16px 18px; }
  .btn-cta { padding: 16px 40px; font-size: 16px; letter-spacing: 3px; }
  .result-dimensions { grid-template-columns: 1fr; }
  .question-text { min-height: 60px; }
}
