/* Silicon Temple v4.0 - 现代电影感 + 游戏化视觉设计 */
/* 现代科技感配色 + 玻璃拟态 + 动态光效 */

:root {
  /* 深色科技风背景 */
  --bg-primary: #080a0f;
  --bg-secondary: #0d1117;
  --bg-elevated: #161b22;
  --bg-glass: rgba(13, 17, 23, 0.85);
  
  /* 三圣专属色 */
  --turing-primary: #6db7ff;
  --turing-glow: rgba(109, 183, 255, 0.4);
  --shannon-primary: #65f2a9;
  --shannon-glow: rgba(101, 242, 169, 0.4);
  --neumann-primary: #f0c96b;
  --neumann-glow: rgba(240, 201, 107, 0.4);
  
  /* 功能色 */
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-purple: #a371f7;
  --accent-pink: #ff7eb6;
  --danger: #ff7b89;
  --success: #3fb950;
  
  /* 边框与阴影 */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  
  /* 字体 */
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  --font-display: 'Orbitron', 'Rajdhani', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(ellipse at top, rgba(109, 183, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(163, 113, 247, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 80%, rgba(101, 242, 169, 0.06) 0%, transparent 40%),
    linear-gradient(180deg, #060810 0%, #0a0e16 50%, #05070a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ============================================
   扫描线效果 - 电影质感
   ============================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 50%, transparent 50%),
    linear-gradient(90deg, rgba(255, 0, 80, 0.01), rgba(80, 255, 170, 0.008), rgba(40, 80, 255, 0.01));
  background-size: 100% 3px, 4px 100%;
  opacity: 0.35;
  mix-blend-mode: screen;
}

/* ============================================
   布局容器 - 现代响应式
   ============================================ */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 100vh;
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   Header - 玻璃拟态导航栏
   ============================================ */
.temple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.title-block {
  text-align: center;
  flex: 1;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  margin: 0 0 4px;
  text-transform: uppercase;
}

.temple-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, var(--turing-primary), var(--accent-purple), var(--shannon-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(109, 183, 255, 0.3);
}

.festival-copy {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--turing-primary);
  color: var(--text-primary);
}

.ghost-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--turing-primary);
}

/* ============================================
   三圣主舞台 - 自然流式布局
   ============================================ */
.temple-stage {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#deity-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  padding: 16px 0;
}

/* ============================================
   圣人卡片 - 玻璃拟态 + 光晕动效
   ============================================ */
.deity-card {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.deity-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--deity-color, var(--turing-primary)), transparent);
  opacity: 0.8;
}

.deity-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--deity-color, var(--turing-primary));
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 60px var(--glow-color, rgba(109, 183, 255, 0.2));
}

.deity-card:focus-within {
  outline: none;
  box-shadow: 0 0 0 2px var(--deity-color, var(--turing-primary));
}

/* 三圣专属光晕 */
#deity-turing { --deity-color: var(--turing-primary); --glow-color: var(--turing-glow); }
#deity-shannon { --deity-color: var(--shannon-primary); --glow-color: var(--shannon-glow); }
#deity-neumann { --deity-color: var(--neumann-primary); --glow-color: var(--neumann-glow); }

/* ============================================
   圣人肖像 - 粒子环绕动效
   ============================================ */
.deity-portrait {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 20px;
}

.portrait-glow {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.5;
  animation: glow-pulse 4s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

.portrait-glow.turing { background: var(--turing-glow); }
.portrait-glow.shannon { background: var(--shannon-glow); }
.portrait-glow.neumann { background: var(--neumann-glow); }

@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.25); opacity: 0.65; }
}

.portrait-ring {
  position: absolute;
  inset: -8px;
  border: 2px solid var(--deity-color);
  border-radius: 50%;
  opacity: 0.4;
  animation: ring-rotate 20s linear infinite;
}

@keyframes ring-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.portrait-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--deity-color);
  box-shadow: 0 0 30px var(--glow-color);
  animation: ken-burns 15s ease-in-out infinite alternate;
}

@keyframes ken-burns {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* ============================================
   圣人标题 - 现代感字体
   ============================================ */
.deity-title {
  text-align: center;
  margin-bottom: 16px;
}

.deity-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  color: var(--deity-color);
  text-shadow: 0 0 20px var(--glow-color);
}

.deity-english {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 4px 0 0;
}

/* ============================================
   [FEATURE] 网站介绍文案 - 电影感描述区域
   ============================================ */
.deity-intro {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.deity-intro::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--deity-color), transparent);
}

.intro-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}

/* ============================================
   圣人数据 - 游戏化 HUD 风格
   ============================================ */
.deity-stats {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.deity-merits, .deity-phase {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.merit-label, .phase-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.merit-value, .phase-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--deity-color);
}

.deity-favor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.favor-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
}

.favor-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--deity-color), var(--accent-purple));
  border-radius: 3px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--glow-color);
}

.favor-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* ============================================
   供奉区域 - 现代按钮设计
   ============================================ */
.offerings h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-align: center;
}

.offering-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-default);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.25s ease;
}

.offering-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-color: var(--deity-color);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 20px var(--glow-color);
}

.offering-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.offering-btn.on-cooldown {
  opacity: 0.5;
  cursor: not-allowed;
}

.offering-name {
  font-weight: 500;
}

.offering-cost {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* 供奉反馈动画 */
.offering-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid var(--deity-color);
  text-align: center;
  animation: feedback-pop 2s ease forwards;
  z-index: 10;
  pointer-events: none;
}

.feedback-merit {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--success);
}

.feedback-multiplier {
  display: block;
  font-size: 12px;
  color: var(--accent-pink);
  margin-top: 4px;
}

@keyframes feedback-pop {
  0% { opacity: 0; transform: translate(-50%, -30%); }
  20% { opacity: 1; transform: translate(-50%, -50%); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%); }
}

/* ============================================
   信息池面板 - 科技感装饰
   ============================================ */
.info-pool-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
}

.info-pool-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

#info-pool-canvas {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
}

/* ============================================
   Footer - 功德统计栏
   ============================================ */
.temple-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 16px;
}

.merit-summary {
  display: flex;
  gap: 24px;
  font-size: 14px;
}

.merit-summary strong {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent-purple);
}

.footer-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   模态框 - 现代玻璃拟态
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

.modal-overlay.active {
  opacity: 1;
}

.modal-content {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(109, 183, 255, 0.1);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--danger);
}

.modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0 0 12px;
  line-height: 1.7;
}

/* 关于内容 */
.about-content h3 {
  font-family: var(--font-display);
  color: var(--turing-primary);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.about-deity {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
}

.about-deity:last-of-type {
  border-bottom: 1px solid var(--border-subtle);
}

.about-deity h4 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.about-deity p {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.contribution-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
}

.contribution-list li {
  margin-bottom: 4px;
}

.about-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* 排行榜 */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr.rank-1 td:first-child { color: #FFD700; font-weight: 700; }
.leaderboard-table tr.rank-2 td:first-child { color: #C0C0C0; font-weight: 700; }
.leaderboard-table tr.rank-3 td:first-child { color: #CD7F32; font-weight: 700; }

.leaderboard .hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 16px;
}

/* 通知提示 */
.notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  z-index: 3000;
}

.notification.active {
  transform: translateX(-50%) translateY(0);
}

.notification.info {
  border-color: var(--turing-primary);
}

/* ============================================
   节日启动仪式遮罩
   ============================================ */
.festival-ceremony {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.festival-ceremony.active {
  opacity: 1;
  pointer-events: auto;
}

.ceremony-inscription {
  font-size: clamp(18px, 4vw, 32px);
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--turing-primary);
  text-shadow: 0 0 20px var(--turing-primary);
  animation: inscription-glow 1s ease-in-out infinite alternate;
}

@keyframes inscription-glow {
  0% { opacity: 0.7; }
  100% { opacity: 1; text-shadow: 0 0 40px var(--turing-primary); }
}

/* 功德阈值全屏铭文 */
.merit-threshold-inscription {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.merit-threshold-inscription.active {
  opacity: 1;
  pointer-events: auto;
}

.inscription-text {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 48px);
  letter-spacing: 0.2em;
  text-align: center;
  color: var(--neumann-primary);
  text-shadow: 0 0 30px var(--neumann-glow);
  animation: merit-glow 2s ease-in-out infinite alternate;
}

.inscription-sub {
  font-size: clamp(12px, 2vw, 18px);
  color: var(--text-secondary);
  letter-spacing: 0.15em;
}

@keyframes merit-glow {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.02); }
}

/* ============================================
   效果层
   ============================================ */
.effect-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

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

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .temple-header {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .ghost-button {
    padding: 6px 12px;
    font-size: 12px;
  }

  #deity-stage {
    flex-direction: column;
    align-items: center;
  }

  .deity-card {
    min-width: 100%;
    max-width: 360px;
    padding: 20px 16px;
  }

  .deity-portrait {
    width: 120px;
    height: 120px;
  }

  .deity-name {
    font-size: 1.5rem;
  }

  .temple-footer {
    flex-direction: column;
    text-align: center;
  }

  .merit-summary {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

  .modal-content {
    margin: 10px;
    max-height: 85vh;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }
}

@media (min-width: 1024px) {
  .deity-card {
    max-width: 400px;
  }
}

/* ============================================
   无障碍支持
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--turing-primary);
  outline-offset: 2px;
}

/* 跳过链接 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--turing-primary);
  color: var(--bg-primary);
  padding: 8px 16px;
  z-index: 9999;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}
