/* =============================================
   「毛怪小镇」人格测试 — 样式表
   ============================================= */

/* =========================================
   基础重置 & 变量
   ========================================= */
:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #4834D4;
  --accent: #FD79A8;
  --bg-start: #0c0c1d;
  --bg-end: #1a1a3e;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* =========================================
   密码锁遮罩
   ========================================= */
.password-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  backdrop-filter: blur(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.password-overlay.unlocked {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.password-modal {
  text-align: center;
  padding: 48px 40px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.password-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}

.password-title {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.password-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.password-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-input {
  flex: 1;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  transition: var(--transition);
  letter-spacing: 4px;
  text-align: center;
}

.password-input:focus {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.1);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.15);
}

.password-input::placeholder {
  letter-spacing: 0;
  color: var(--text-muted);
}

.password-submit {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-submit:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}

.password-error {
  display: none;
  margin-top: 16px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text-primary);
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   页面容器
   ========================================= */
.page {
  display: none;
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: flex;
}

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

/* =========================================
   通用按钮
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border: none;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-share {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-share:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* =========================================
   首页
   ========================================= */
#page-home {
  align-items: center;
  justify-content: center;
  position: relative;
}

.home-container {
  position: relative;
  max-width: 600px;
  width: 100%;
  padding: 40px 24px;
  text-align: center;
  z-index: 1;
}

/* 浮动装饰 */
.floating-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.shape {
  position: absolute;
  font-size: 40px;
  opacity: 0.15;
  animation: float 6s ease-in-out infinite;
}

.shape-1 { top: 10%; left: 10%; animation-delay: 0s; font-size: 50px; }
.shape-2 { top: 20%; right: 15%; animation-delay: 1s; font-size: 35px; }
.shape-3 { bottom: 25%; left: 8%; animation-delay: 2s; font-size: 45px; }
.shape-4 { bottom: 15%; right: 10%; animation-delay: 0.5s; font-size: 30px; }
.shape-5 { top: 45%; left: 5%; animation-delay: 1.5s; font-size: 25px; }
.shape-6 { top: 35%; right: 5%; animation-delay: 2.5s; font-size: 55px; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.home-content {
  position: relative;
  z-index: 1;
}

.home-badge {
  display: inline-block;
  padding: 4px 16px;
  background: rgba(108, 92, 231, 0.3);
  border: 1px solid rgba(108, 92, 231, 0.5);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-light);
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.home-title {
  margin-bottom: 24px;
  line-height: 1.2;
}

.title-main {
  display: block;
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
}

.title-sub {
  display: block;
  font-size: 28px;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 8px;
}

.home-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.home-desc strong {
  color: var(--primary-light);
  font-weight: 600;
}

.home-members-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
}

.home-members-preview span {
  padding: 6px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.home-members-preview span:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--primary);
  color: var(--text-primary);
}

.home-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* =========================================
   加载页
   ========================================= */
#page-loading {
  align-items: center;
  justify-content: center;
}

.loading-container {
  text-align: center;
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 32px;
}

.spinner-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary-light);
  border-right-color: var(--accent);
  animation: spin 1s linear infinite;
}

.spinner-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

.loading-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.loading-bar-track {
  width: 280px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  width: 0%;
  transition: width 0.1s ease;
}

/* =========================================
   答题页
   ========================================= */
#page-quiz {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.quiz-container {
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: calc(var(--vh, 1vh) * 100 - 48px);
}

.quiz-header {
  margin-bottom: 40px;
}

.quiz-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quiz-question-number {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.quiz-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quiz-question-wrap {
  margin-bottom: 32px;
}

.quiz-question {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
  padding: 0 4px;
}

.quiz-options {
  display: grid;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.quiz-options.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.option-card:hover {
  border-color: rgba(108, 92, 231, 0.4);
  background: rgba(108, 92, 231, 0.08);
  transform: translateX(4px);
}

.option-card.selected {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.15);
  transform: translateX(8px);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
}

.option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: var(--transition);
}

.option-card.selected .option-label {
  background: var(--primary);
  color: #fff;
}

.option-text {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.4;
  transition: var(--transition);
}

.option-card.selected .option-text {
  color: var(--text-primary);
}

.quiz-footer {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.btn-next {
  width: 200px;
}

/* 维度指示器 */
.quiz-dim-indicator {
  display: none;
}

.dim-indicator-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: dimPulse 2s ease-in-out infinite;
}

@keyframes dimPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

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

.dim-indicator-value {
  font-size: 13px;
  color: var(--primary-light);
  font-weight: 600;
}

/* 隐藏——题目维度标签在答题时不显示 */
.question-dim-tag {
  display: none;
}

/* =========================================
   结果页
   ========================================= */
#page-result {
  align-items: flex-start;
  justify-content: center;
  padding: 24px 24px 48px;
}

.result-container {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.result-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  margin-bottom: 24px;
}

.result-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 头 */
.result-header {
  text-align: center;
  margin-bottom: 32px;
}

.result-badge {
  display: inline-block;
  padding: 4px 16px;
  background: rgba(253, 121, 168, 0.2);
  border: 1px solid rgba(253, 121, 168, 0.4);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
}

.result-heading {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Emoji 头像 */
.result-avatar-section {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
}

.result-emoji-frame {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-emoji {
  font-size: 52px;
  line-height: 1;
  position: relative;
  z-index: 1;
  animation: emojiBounce 3s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(108, 92, 231, 0.3));
}

.result-emoji-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), var(--accent), var(--primary-light), var(--primary));
  animation: glowSpin 3s linear infinite;
  opacity: 0.3;
  filter: blur(6px);
}

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

@keyframes emojiBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.1); }
}

.result-name-section {
  flex: 1;
}

.result-name {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-title-tag {
  font-size: 16px;
  color: var(--primary-light);
  font-weight: 500;
}

/* 标签 */
.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
}

.badge-mbti {
  background: rgba(108, 92, 231, 0.2);
  border: 1px solid rgba(108, 92, 231, 0.4);
  color: var(--primary-light);
}

.badge-dim {
  background: rgba(0, 184, 148, 0.2);
  border: 1px solid rgba(0, 184, 148, 0.4);
  color: #00B894;
}

.badge-role {
  background: rgba(253, 121, 168, 0.2);
  border: 1px solid rgba(253, 121, 168, 0.4);
  color: var(--accent);
}

/* 语录 */
.result-quote-section {
  text-align: center;
  padding: 20px;
}

.result-quote {
  font-size: 18px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
  position: relative;
}

.result-quote::before {
  content: '"';
  font-size: 48px;
  color: var(--primary-light);
  opacity: 0.3;
  position: absolute;
  top: -16px;
  left: -8px;
}

/* 卡片 */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.result-summary {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.9;
}

/* 优势劣势 */
.result-traits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .result-traits {
    grid-template-columns: 1fr;
  }
}

.trait-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}

.trait-card ul {
  list-style: none;
  padding: 0;
}

.trait-card li {
  position: relative;
  padding: 6px 0 6px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.trait-card li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--primary-light);
  font-weight: 700;
}

.trait-strengths .section-title {
  color: #00B894;
}

.trait-weaknesses .section-title {
  color: var(--accent);
}

/* 附加信息 */
.result-extras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .result-extras {
    grid-template-columns: 1fr;
  }
}

.extra-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.extra-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.extra-value {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 500;
}

/* 分数柱状图 */
.result-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-wrap {
  display: grid;
  grid-template-columns: 80px 1fr 36px;
  gap: 12px;
  align-items: end;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chart-bar-wrap.is-result {
  background: rgba(108, 92, 231, 0.08);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  margin: 0 -8px;
  border-bottom: none;
}

.chart-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.chart-bar-wrap.is-result .chart-bar-label {
  color: var(--primary-light);
  font-weight: 700;
}

.chart-bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}

.chart-bar-wrap.is-result .chart-bar-value {
  color: var(--primary-light);
}

/* 四维结果卡片 */
.result-dims-section {
  margin-bottom: 24px;
}

.result-dims {
  display: grid;
  gap: 12px;
}

.dim-result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

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

.dim-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dim-pole-result {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 50px;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.3);
  color: var(--primary-light);
}

.dim-bar-track {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.dim-bar-left {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 10px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.dim-bar-right {
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.dim-bar-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

.dim-best {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dim-best-label {
  font-size: 12px;
  color: var(--text-muted);
}

.dim-best-member {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dim-best-title {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 操作按钮 */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 底部 */
.result-footer {
  text-align: center;
  padding: 32px 0 16px;
}

.result-footer p {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* =========================================
   滚动条
   ========================================= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   响应式
   ========================================= */
@media (max-width: 480px) {
  .title-main {
    font-size: 36px;
  }

  .title-sub {
    font-size: 20px;
    letter-spacing: 6px;
  }

  .home-desc {
    font-size: 14px;
  }

  .quiz-question {
    font-size: 18px;
  }

  .option-card {
    padding: 14px 16px;
  }

  .option-text {
    font-size: 14px;
  }

  .result-avatar-section {
    flex-direction: column;
    text-align: center;
  }

  .result-name {
    font-size: 26px;
  }

  .result-emoji {
    font-size: 44px;
  }

  .password-modal {
    padding: 32px 24px;
  }

  .password-title {
    font-size: 20px;
  }

  .quiz-container {
    min-height: calc(var(--vh, 1vh) * 100 - 48px);
  }
}

@media (max-width: 360px) {
  .title-main {
    font-size: 28px;
  }

  .chart-bar-wrap {
    grid-template-columns: 60px 1fr 30px;
    gap: 6px;
  }

  .chart-bar-label {
    font-size: 10px;
  }
}
