/* 3:00 AM 赛博失眠症与抽象人格诊断 - 全局样式 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@400;700;900&family=ZCOOL+KuaiLe&display=swap');

:root {
  --bg-dark: #080911;
  --bg-card: rgba(18, 20, 36, 0.75);
  --border-neon: rgba(168, 85, 247, 0.3);
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-green: #22c55e;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-heading: 'Outfit', 'ZCOOL KuaiLe', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-glow: 0 0 35px rgba(168, 85, 247, 0.25);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* 动态赛博暗黑粒子背景 */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* 主容器 */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* 顶部跑马灯 / 计时器标语 */
.header-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 18px;
  border-radius: 100px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.clock-tag {
  color: var(--accent-pink);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulse-glow 2s infinite alternate;
}

.live-dots {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
}

/* 视图通用面板 */
.view-panel {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.view-panel.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
}

/* 霓虹特效线饰 */
.view-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-purple), transparent);
  animation: scanline 4s linear infinite;
}

@keyframes scanline {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(50%); }
}

/* === 首页视图 === */
.title-box {
  text-align: center;
  margin-bottom: 24px;
}

.glitch-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.2;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-purple) 70%, var(--accent-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
  position: relative;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 8px;
  line-height: 1.5;
}

/* 电子木鱼互动区 */
.muyu-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0 28px 0;
  position: relative;
  width: 100%;
}

/* 电子木鱼 SVG */
.muyu-svg {
  width: 60px;
  height: 60px;
  filter: drop-shadow(0 0 8px var(--accent-purple));
  animation: pulse-glow 2s infinite alternate;
}

.abstract-svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.6));
}

.btn-icon-svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.inline-icon-svg {
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  display: inline-block;
  margin-right: 4px;
}

.muyu-btn:active {
  transform: scale(0.9);
  box-shadow: 0 0 40px var(--accent-pink);
}

.muyu-counter {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--accent-cyan);
  font-weight: 600;
  background: rgba(6, 182, 212, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

/* 浮动功德动画 */
.merit-float {
  position: absolute;
  top: -10px;
  color: #fef08a;
  font-weight: bold;
  font-size: 1.1rem;
  pointer-events: none;
  animation: floatUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) FORWARDS;
  text-shadow: 0 0 8px rgba(254, 240, 138, 0.8);
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(1.3);
  }
}

/* 按钮通用 */
.cyber-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(236, 72, 153, 0.35);
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.cyber-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(236, 72, 153, 0.5);
}

.cyber-btn:active {
  transform: translateY(1px);
}

/* === 答题视图 === */
.quiz-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-step {
  font-size: 0.85rem;
  color: var(--accent-purple);
  font-weight: 800;
  letter-spacing: 1px;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin: 0 14px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.question-card {
  width: 100%;
  margin-bottom: 24px;
}

.question-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.6;
  color: #ffffff;
  margin-bottom: 20px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.option-item {
  width: 100%;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.option-item:hover {
  background: rgba(168, 85, 247, 0.12);
  border-color: var(--accent-purple);
  transform: translateX(4px);
}

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

.option-letter {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

/* === 加载过渡页 === */
.loading-view {
  text-align: center;
  padding: 40px 10px;
}

.cyber-spinner {
  width: 70px;
  height: 70px;
  border: 4px solid rgba(168, 85, 247, 0.15);
  border-top-color: var(--accent-pink);
  border-right-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px auto;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

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

.loading-text {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.loading-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  animation: pulse-glow 1.5s infinite alternate;
}

/* === 诊断结果页 === */
.result-card-container {
  width: 100%;
  background: linear-gradient(180deg, rgba(20, 24, 48, 0.9) 0%, rgba(10, 12, 26, 0.95) 100%);
  border: 2px solid rgba(168, 85, 247, 0.4);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.3);
  position: relative;
}

.result-header {
  text-align: center;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.avatar-large {
  font-size: 4rem;
  margin-bottom: 6px;
  display: inline-block;
  animation: floatAvatar 3s ease-in-out infinite alternate;
}

@keyframes floatAvatar {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.persona-name {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.persona-tagline {
  font-size: 0.88rem;
  color: var(--accent-pink);
  font-style: italic;
  font-weight: 600;
}

/* 诊断指标卡 */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.metric-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* 五维雷达图容器 */
.radar-box {
  width: 100%;
  height: 240px;
  position: relative;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#radar-canvas {
  width: 100%;
  height: 100%;
}

/* 深度诊断评价 */
.summary-box {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-purple);
  padding: 14px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e5e7eb;
  margin-bottom: 16px;
}

/* 匹配/排斥关系 */
.relation-box {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.relation-card {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.relation-title {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.relation-name {
  font-weight: 700;
  color: var(--accent-cyan);
}

/* 朋友圈发疯文案盒 */
.viral-copy-box {
  background: rgba(236, 72, 153, 0.08);
  border: 1px dashed var(--accent-pink);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
}

.viral-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-pink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.viral-content {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #f3f4f6;
  user-select: all;
}

.copy-btn {
  margin-top: 10px;
  padding: 6px 12px;
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid var(--accent-pink);
  color: #fff;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.copy-btn:active {
  transform: scale(0.95);
  background: var(--accent-pink);
}

/* 操作按钮组 */
.action-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

/* Toast 提示 */
.toast-msg {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(168, 85, 247, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
}

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

/* 海报渲染 Canvas（隐藏或模态框） */
#poster-canvas {
  display: none;
}

/* 适配超小屏幕 */
@media (max-width: 380px) {
  .glitch-title { font-size: 1.8rem; }
  .view-panel { padding: 20px 16px; }
  .persona-name { font-size: 1.4rem; }
}
