/* ==================== 基础变量与重置 ==================== */
:root {
  --midnight-blue: #0a0e27;
  --deep-night: #0d1333;
  --fog-purple: #2d1b4e;
  --warm-white: #f5f0eb;
  --light-gold: #d4a853;
  --soft-gold: #c9956b;
  --muted-purple: #6b5b8a;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --text-primary: #f5f0eb;
  --text-secondary: rgba(245, 240, 235, 0.78);
  --text-dim: rgba(245, 240, 235, 0.55);
  --flame-glow: #d4a853;
  --flame-glow-bright: #f0c76e;
  --planet-glow: rgba(100, 140, 255, 0.4);
  --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--midnight-blue);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

/* ==================== 星空背景 ==================== */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, var(--fog-purple) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(45, 27, 78, 0.5) 0%, transparent 40%),
              radial-gradient(ellipse at 50% 80%, rgba(10, 14, 39, 0.8) 0%, transparent 60%),
              linear-gradient(180deg, var(--midnight-blue) 0%, var(--deep-night) 100%);
  pointer-events: none;
}

#starfield::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 25% 35%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 40% 10%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 25%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 85% 55%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 15% 65%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 35% 80%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 80% 85%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 5% 90%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 90% 10%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 50% 50%, rgba(212, 168, 83, 0.5), transparent),
    radial-gradient(1px 1px at 20% 50%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 75% 75%, rgba(255, 255, 255, 0.6), transparent);
  animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* ==================== 页面切换 ==================== */
.page {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  animation: fadeIn 0.8s ease-out;
}

.page.active {
  display: block;
}

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

/* ==================== 通用组件 ==================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 32px var(--glass-shadow);
}

.page-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--warm-white);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.page-desc {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-size: 0.95rem;
}

/* 按钮 */
.btn-primary {
  background: linear-gradient(135deg, var(--light-gold) 0%, var(--soft-gold) 100%);
  color: var(--midnight-blue);
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
  height: auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  line-height: 1.4;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 168, 83, 0.35);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  height: auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  line-height: 1.4;
}

.btn-secondary:hover {
  border-color: var(--light-gold);
  color: var(--light-gold);
  background: rgba(212, 168, 83, 0.08);
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.05rem;
}

.hidden {
  display: none !important;
}

/* 表单 */
.input-field {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.input-field::placeholder {
  color: var(--text-dim);
}

.input-field:focus {
  border-color: var(--light-gold);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.1);
}

.textarea-field {
  min-height: 120px;
  resize: vertical;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group label[for] {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.form-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ==================== 统一 :focus-visible 样式 ==================== */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.upload-area:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--light-gold);
  outline-offset: 2px;
}

/* 移除默认 outline，只保留 focus-visible */
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ==================== 体验导览 ==================== */
.guide-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.guide-panel.hidden {
  display: none;
}

.guide-panel-inner {
  max-width: 480px;
  width: 90%;
}

.guide-panel-inner h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--light-gold);
}

.guide-panel-inner p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.guide-panel-inner ol {
  padding-left: 20px;
  margin-bottom: 20px;
}

.guide-panel-inner li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

#btn-start-guide {
  font-size: 1.05rem;
  padding: 16px;
  border-radius: 14px;
}

/* ==================== 导览浮层 ==================== */
.guide-overlay {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  background: rgba(212, 168, 83, 0.15);
  border: 1px solid rgba(212, 168, 83, 0.3);
  border-radius: 24px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.guide-overlay.hidden {
  display: none !important;
}

.guide-overlay-text {
  font-size: 0.85rem;
  color: var(--light-gold);
  font-weight: 500;
}

.guide-overlay-stop {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 4px 14px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: var(--transition);
}

.guide-overlay-stop:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalIn 0.4s ease-out;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 90%;
  animation: modalContentIn 0.4s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content h3 {
  font-size: 1.25rem;
  color: var(--warm-white);
  margin-bottom: 16px;
  text-align: center;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1;
  min-width: 160px;
  text-align: center;
}

/* 伦理弹窗 */
.ethics-icon {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 16px;
}

.ethics-body p {
  text-align: left;
  padding: 4px 0;
}

.ethics-body strong {
  color: var(--light-gold);
}

/* 互动反馈弹窗 */
.interaction-feedback {
  text-align: center;
}

.interaction-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.interaction-feedback p {
  font-size: 1.05rem;
  color: var(--text-primary);
}

/* ==================== 模块1：首页 ==================== */
#page-home {
  display: none;
  min-height: 100vh;
}

#page-home.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-container {
  text-align: center;
  padding: 60px 24px;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  animation: homeFadeIn 1.2s ease-out;
}

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

.home-planet-decoration {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 40px;
}

.deco-planet {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 35%,
    rgba(140, 160, 255, 0.5),
    rgba(80, 100, 200, 0.3) 40%,
    rgba(45, 27, 78, 0.6) 70%,
    rgba(10, 14, 39, 0.8));
  box-shadow:
    0 0 40px rgba(100, 140, 255, 0.3),
    0 0 80px rgba(100, 140, 255, 0.15),
    inset -10px -10px 20px rgba(0, 0, 0, 0.4),
    inset 5px 5px 15px rgba(255, 255, 255, 0.1);
  animation: planetFloat 6s ease-in-out infinite;
}

.deco-glow {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(212, 168, 83, 0.15) 0%,
    rgba(100, 140, 255, 0.08) 40%,
    transparent 70%);
  animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes planetFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-12px); }
}

@keyframes glowPulse {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

.home-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--warm-white);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--warm-white) 0%, var(--light-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 400;
}

.home-slogan {
  font-size: 1.3rem;
  color: var(--light-gold);
  margin-bottom: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-style: italic;
}

.home-description {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 40px;
  line-height: 1.9;
}

.home-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.home-values {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  margin-top: 0;
}

.value-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.value-icon {
  font-size: 1.8rem;
  opacity: 0.7;
}

/* 重置链接样式 */
.home-reset {
  margin-top: 32px;
  text-align: center;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 16px;
  transition: var(--transition);
}

.btn-text-link:hover {
  color: var(--text-secondary);
}

.btn-text-link:focus-visible {
  outline: 2px solid var(--light-gold);
  outline-offset: 2px;
}

/* ==================== 模块3：创建星球页 ==================== */
.create-form {
  padding: 40px;
}

/* 照片上传 */
.upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 120px;
}

.upload-area:hover {
  border-color: var(--light-gold);
  background: rgba(212, 168, 83, 0.04);
}

.upload-area.dragover {
  border-color: var(--light-gold);
  background: rgba(212, 168, 83, 0.08);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.upload-icon {
  font-size: 2rem;
}

.upload-preview {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.upload-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 示例照片角标水印 */
.photo-watermark {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.02em;
  z-index: 1;
}

/* 示例照片统一说明文字 */
.example-photo-caption {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 10px;
  line-height: 1.6;
  padding: 0 8px;
}

.example-photo-caption.hidden {
  display: none;
}

.upload-preview-item .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 扩大触控区域到 44×44px，视觉尺寸保持 24px */
  padding: 0;
  outline: none;
  z-index: 2;
}

.upload-preview-item .remove-photo::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.upload-preview-item .remove-photo:hover,
.upload-preview-item .remove-photo:focus-visible {
  background: rgba(0, 0, 0, 0.8);
}

/* 上传错误提示 */
.upload-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 8px;
  text-align: center;
}

/* ==================== 模块4：AI 生成过程页 ==================== */
.generating-container {
  text-align: center;
  padding-top: 40px;
}

.generating-planet-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 40px auto 48px;
}

.generating-planet {
  width: 140px;
  height: 140px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.gen-planet-core {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 35%,
    rgba(140, 160, 255, 0.4),
    rgba(80, 100, 200, 0.2) 40%,
    rgba(45, 27, 78, 0.4) 70%,
    rgba(10, 14, 39, 0.6));
  box-shadow:
    0 0 30px rgba(100, 140, 255, 0.2),
    0 0 60px rgba(100, 140, 255, 0.1);
  animation: genPlanetPulse 2s ease-in-out infinite;
  transition: all 0.8s ease;
}

.gen-planet-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(212, 168, 83, 0.2);
  animation: genRingRotate 8s linear infinite;
  transition: all 0.8s ease;
}

@keyframes genPlanetPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(100, 140, 255, 0.2), 0 0 60px rgba(100, 140, 255, 0.1); }
  50% { box-shadow: 0 0 50px rgba(100, 140, 255, 0.4), 0 0 100px rgba(100, 140, 255, 0.2); }
}

@keyframes genRingRotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.generating-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gen-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.8);
  animation: particleDrift 3s ease-in-out infinite;
}

@keyframes particleDrift {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0);
  }
  50% {
    opacity: 1;
    transform: translate(var(--dx), var(--dy)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx2), var(--dy2)) scale(0);
  }
}

.generating-stages {
  max-width: 360px;
  margin: 0 auto 32px;
  text-align: left;
}

.gen-stage {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  opacity: 0.35;
  transition: opacity 0.5s ease;
}

.gen-stage.active {
  opacity: 1;
}

.gen-stage.done {
  opacity: 0.6;
}

.stage-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.5s ease;
  flex-shrink: 0;
}

.gen-stage.active .stage-indicator {
  background: var(--light-gold);
  box-shadow: 0 0 12px rgba(212, 168, 83, 0.6);
  animation: indicatorPulse 1.2s ease-in-out infinite;
}

.gen-stage.done .stage-indicator {
  background: rgba(100, 200, 150, 0.8);
  color: white;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@keyframes indicatorPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(212, 168, 83, 0.6); }
  50% { box-shadow: 0 0 20px rgba(212, 168, 83, 0.9); }
}

.stage-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.gen-stage.active .stage-text {
  color: var(--warm-white);
}

.generating-progress {
  max-width: 360px;
  margin: 0 auto;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--light-gold), var(--flame-glow-bright));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* 跳过动画按钮 */
#btn-skip-gen {
  font-size: 0.85rem;
  padding: 10px 24px;
  opacity: 0.7;
}

#btn-skip-gen:hover {
  opacity: 1;
}

/* Demo 标注样式 */
.demo-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 16px;
  padding: 0 24px;
}



/* ==================== 模块5：记忆 DNA ==================== */
.dna-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.dna-card,
.family-memory-card,
.memorial-card-preview {
  padding: 28px;
}

.dna-card:first-child {
  grid-column: 1 / -1;
}

.dna-card h3 {
  font-size: 1.05rem;
  color: var(--light-gold);
  margin-bottom: 12px;
}

.dna-content {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.dna-content ul {
  list-style: none;
  padding: 0;
}

.dna-content li {
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
}

.dna-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--light-gold);
  opacity: 0.6;
}

.dna-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==================== 模块6：第一封信 ==================== */
.letter-container {
  max-width: 580px;
}

.letter-envelope {
  padding: 48px 40px;
  margin-bottom: 24px;
  position: relative;
}

.letter-envelope::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--light-gold), transparent);
  border-radius: 2px;
}

.letter-header {
  text-align: center;
  margin-bottom: 32px;
}

.letter-from {
  font-size: 0.9rem;
  color: var(--light-gold);
  font-weight: 500;
}

.letter-body {
  max-width: 520px;
  margin: 0 auto;
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 2;
  text-align: left;
}

.letter-body p {
  margin-bottom: 16px;
  text-indent: 2em;
}

.letter-body .letter-sign {
  text-align: right;
  text-indent: 0;
  color: var(--light-gold);
  margin-top: 24px;
}

.letter-footer {
  text-align: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.letter-footer span {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

.letter-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==================== 模块7：记忆小窝 ==================== */
.den-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}

.pause-btn {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 10px 24px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  z-index: 10;
}

.pause-btn:hover {
  border-color: var(--muted-purple);
  color: var(--text-secondary);
}

/* 记忆星球 */
.den-planet-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 20px auto 40px;
}

.den-planet {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: denPlanetBreathe 5s ease-in-out infinite;
}

.planet-surface {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    rgba(160, 180, 255, 0.5),
    rgba(100, 120, 220, 0.35) 30%,
    rgba(80, 80, 180, 0.3) 50%,
    rgba(45, 27, 78, 0.5) 70%,
    rgba(10, 14, 39, 0.7) 90%);
  box-shadow:
    0 0 50px rgba(100, 140, 255, 0.3),
    0 0 100px rgba(100, 140, 255, 0.15),
    0 0 150px rgba(212, 168, 83, 0.1),
    inset -15px -15px 30px rgba(0, 0, 0, 0.5),
    inset 8px 8px 20px rgba(255, 255, 255, 0.08);
}

.planet-atmosphere {
  position: absolute;
  top: -20px;
  left: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(100, 140, 255, 0.08) 60%,
    rgba(212, 168, 83, 0.05) 75%,
    transparent 100%);
  animation: atmosphereGlow 4s ease-in-out infinite alternate;
}

@keyframes denPlanetBreathe {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 50px rgba(100, 140, 255, 0.3), 0 0 100px rgba(100, 140, 255, 0.15);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.04);
    box-shadow: 0 0 70px rgba(100, 140, 255, 0.45), 0 0 130px rgba(100, 140, 255, 0.25);
  }
}

@keyframes atmosphereGlow {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 脚印光点 */
.footprint-lights {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.footprint {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.8);
  box-shadow: 0 0 8px rgba(212, 168, 83, 0.6);
  animation: footprintGlow 3s ease-in-out infinite;
}

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

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

/* 火苗状态 */
.flame-status {
  margin: 20px auto 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.flame-container {
  width: 48px;
  height: 60px;
  position: relative;
}

.flame {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 36px;
}

.flame-inner {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 28px;
  background: radial-gradient(ellipse at bottom,
    rgba(255, 200, 80, 0.9),
    rgba(212, 168, 83, 0.6) 50%,
    transparent 100%);
  border-radius: 50% 50% 20% 20%;
  animation: flameInnerFlicker 1.5s ease-in-out infinite;
}

.flame-outer {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 40px;
  background: radial-gradient(ellipse at bottom,
    rgba(212, 168, 83, 0.5),
    rgba(200, 100, 50, 0.3) 50%,
    transparent 100%);
  border-radius: 50% 50% 20% 20%;
  animation: flameOuterFlicker 2s ease-in-out infinite;
  filter: blur(2px);
}

@keyframes flameInnerFlicker {
  0%, 100% { height: 28px; opacity: 0.7; }
  25% { height: 32px; opacity: 0.9; }
  50% { height: 26px; opacity: 0.8; }
  75% { height: 30px; opacity: 0.85; }
}

@keyframes flameOuterFlicker {
  0%, 100% { height: 40px; opacity: 0.5; }
  33% { height: 46px; opacity: 0.65; }
  66% { height: 38px; opacity: 0.45; }
}

/* 火苗状态：常亮 */
.flame-status.state-bright .flame-inner {
  height: 36px;
  background: radial-gradient(ellipse at bottom,
    rgba(255, 220, 100, 1),
    rgba(240, 180, 60, 0.8) 50%,
    transparent 100%);
  animation: flameInnerBright 1.2s ease-in-out infinite;
}

.flame-status.state-bright .flame-outer {
  height: 52px;
  background: radial-gradient(ellipse at bottom,
    rgba(255, 200, 80, 0.7),
    rgba(212, 168, 83, 0.5) 50%,
    transparent 100%);
  animation: flameOuterBright 1.5s ease-in-out infinite;
  filter: blur(3px);
}

@keyframes flameInnerBright {
  0%, 100% { height: 36px; opacity: 0.85; }
  50% { height: 40px; opacity: 1; }
}

@keyframes flameOuterBright {
  0%, 100% { height: 52px; opacity: 0.6; }
  50% { height: 58px; opacity: 0.8; }
}

/* 火苗状态：星河 */
.flame-status.state-galaxy .flame-inner {
  height: 44px;
  background: radial-gradient(ellipse at bottom,
    rgba(255, 240, 150, 1),
    rgba(255, 210, 80, 0.9) 40%,
    rgba(212, 168, 83, 0.5) 70%,
    transparent 100%);
  animation: flameInnerGalaxy 1s ease-in-out infinite;
}

.flame-status.state-galaxy .flame-outer {
  height: 60px;
  width: 28px;
  background: radial-gradient(ellipse at bottom,
    rgba(255, 220, 100, 0.8),
    rgba(212, 168, 83, 0.6) 40%,
    rgba(150, 120, 255, 0.3) 70%,
    transparent 100%);
  animation: flameOuterGalaxy 1.3s ease-in-out infinite;
  filter: blur(4px);
}

@keyframes flameInnerGalaxy {
  0%, 100% { height: 44px; opacity: 0.9; }
  50% { height: 48px; opacity: 1; }
}

@keyframes flameOuterGalaxy {
  0%, 100% { height: 60px; opacity: 0.7; }
  50% { height: 66px; opacity: 0.9; }
}

.flame-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--light-gold);
}

.flame-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 320px;
}

/* 统计 */
.den-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--light-gold);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* 最近记忆卡 */
.recent-memory {
  text-align: left;
  margin-bottom: 32px;
}

.recent-memory h3 {
  font-size: 1.05rem;
  color: var(--light-gold);
  margin-bottom: 12px;
}

.recent-memory-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  overflow: hidden;
}

.recent-memory-body::after {
  content: '';
  display: table;
  clear: both;
}

/* 互动按钮 */
.den-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.action-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.action-btn:hover {
  border-color: var(--light-gold);
  background: rgba(212, 168, 83, 0.06);
  color: var(--light-gold);
  transform: translateY(-2px);
}

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

.action-icon {
  font-size: 1.4rem;
}

/* ==================== 模块8：家庭共忆 ==================== */
.family-memory-list {
  margin-bottom: 32px;
}

.family-memory-card {
  padding: 28px;
  margin-bottom: 16px;
}

.family-memory-card .memory-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.family-memory-card .author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--light-gold), var(--muted-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  font-weight: 600;
}

.family-memory-card .author-info {
  display: flex;
  flex-direction: column;
}

.family-memory-card .author-name {
  font-size: 0.95rem;
  color: var(--warm-white);
  font-weight: 600;
}

.family-memory-card .author-relation {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.family-memory-card .memory-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  padding-left: 46px;
}

.family-add {
  margin-bottom: 32px;
}

.family-add h3 {
  font-size: 1.1rem;
  color: var(--warm-white);
  margin-bottom: 20px;
}

.family-summary h3 {
  font-size: 1.15rem;
  color: var(--light-gold);
  margin-bottom: 16px;
}

.summary-content {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.flame-change-notice {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.9rem;
  color: var(--light-gold);
}

/* ==================== 模块9：导出纪念卡 ==================== */
.export-container {
  text-align: center;
}

.memorial-card {
  max-width: 360px;
  margin: 0 auto 32px;
  position: relative;
}

#memorial-canvas {
  display: none;
}

.memorial-card-preview {
  padding: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.memorial-card-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent,
    var(--light-gold),
    var(--muted-purple),
    var(--light-gold),
    transparent);
}

.card-photo-area {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
  overflow: hidden;
  border: 2px solid rgba(212, 168, 83, 0.3);
}

.card-photo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-top-deco {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: radial-gradient(circle at 35% 35%,
    rgba(160, 180, 255, 0.5),
    rgba(100, 120, 220, 0.3) 40%,
    rgba(45, 27, 78, 0.5) 70%,
    rgba(10, 14, 39, 0.7));
  box-shadow: 0 0 30px rgba(100, 140, 255, 0.3);
  animation: cardPlanetFloat 6s ease-in-out infinite;
}

@keyframes cardPlanetFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.card-pet-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--warm-white);
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--warm-white), var(--light-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-years {
  font-size: 1rem;
  color: var(--light-gold);
  margin-bottom: 20px;
  font-weight: 500;
}

.card-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--light-gold), transparent);
  margin: 20px auto;
}

.card-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
  font-style: italic;
}

.card-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 32px;
  margin-bottom: 28px;
}

.card-stat {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.card-stat span {
  color: var(--light-gold);
  font-weight: 600;
}

.card-slogan {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 12px;
}

.card-brand {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  opacity: 0.6;
}

.card-bottom-deco {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--light-gold), transparent);
  border-radius: 2px;
  margin: 16px auto 0;
}

.export-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==================== 压缩页面高度 ==================== */
.page-container.compact {
  padding-top: 80px;
}

/* ==================== 全局步骤进度条 ==================== */
.step-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 90;
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 16px;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.step-progress.visible {
  transform: translateY(0);
}

/* 移动端步骤进度条文本 */
.step-progress-mobile {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: var(--light-gold);
  padding: 4px 0;
  font-weight: 500;
}

/* 安静模式标识（移入进度栏） */
.quiet-mode-tag {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--muted-purple);
  background: rgba(107, 91, 138, 0.2);
  border: 1px solid rgba(107, 91, 138, 0.3);
  border-radius: 10px;
  padding: 2px 10px;
  white-space: nowrap;
}

.step-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.step-list::-webkit-scrollbar { display: none; }
.step-item {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 12px;
  background: transparent;
  transition: all 0.3s ease;
  cursor: default;
  white-space: nowrap;
}
.step-item.active {
  color: var(--light-gold);
  background: rgba(212, 168, 83, 0.12);
  font-weight: 600;
}
.step-item.done {
  color: rgba(100, 200, 150, 0.8);
}
.step-item::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  background: currentColor;
  opacity: 0.5;
  vertical-align: middle;
}
.step-item.active::before { opacity: 1; }
.step-item.done::before { opacity: 0.8; }

/* ==================== 快捷入口 ==================== */
.den-shortcuts {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.shortcut-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.shortcut-btn:hover {
  border-color: var(--light-gold);
  color: var(--light-gold);
  background: rgba(212, 168, 83, 0.06);
}
.shortcut-arrow {
  opacity: 0.4;
  font-size: 0.8rem;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .home-title {
    font-size: 2.2rem;
  }

  .home-subtitle {
    font-size: 1rem;
  }

  .home-slogan {
    font-size: 1.1rem;
  }

  .home-actions {
    flex-direction: column;
    align-items: center;
  }

  .home-values {
    gap: 32px;
  }

  .page-container {
    padding: 40px 16px 32px;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .create-form {
    padding: 24px;
  }

  .glass-card {
    padding: 24px;
  }

  .modal-content {
    width: 95%;
    padding: 24px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn-primary,
  .modal-actions .btn-secondary {
    min-width: auto;
  }

  .dna-grid {
    grid-template-columns: 1fr;
  }

  .dna-card:first-child {
    grid-column: auto;
  }

  .dna-card, .family-memory-card, .memorial-card-preview {
    padding: 20px;
  }

  .page-container.compact {
    padding-top: 60px;
  }

  .step-progress {
    padding: 8px 12px;
  }

  .step-progress-mobile {
    font-size: 0.75rem;
  }

  .quiet-mode-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    right: 12px;
  }

  .step-item {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .letter-envelope {
    padding: 32px 24px;
  }

  .den-planet-wrapper {
    width: 200px;
    height: 200px;
  }

  .den-planet {
    width: 130px;
    height: 130px;
  }

  .den-stats {
    gap: 24px;
  }

  .den-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .pause-btn {
    bottom: 16px;
    padding: 8px 20px;
    font-size: 0.8rem;
  }

  .home-actions .btn-text-link {
    font-size: 0.9rem;
  }

  .home-planet-decoration {
    width: 140px;
    height: 140px;
  }

  .deco-planet {
    width: 90px;
    height: 90px;
  }

  .deco-glow {
    width: 140px;
    height: 140px;
  }

  .generating-planet-wrapper {
    width: 160px;
    height: 160px;
  }

  .gen-planet-core {
    width: 70px;
    height: 70px;
  }

  .gen-planet-ring {
    width: 100px;
    height: 100px;
  }

  .card-stats {
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .home-title {
    font-size: 1.8rem;
  }

  .home-description {
    font-size: 0.88rem;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .btn-primary, .btn-secondary {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 0.9rem;
  }

  .den-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .action-btn {
    padding: 12px 8px;
    font-size: 0.8rem;
  }
}

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

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

::-webkit-scrollbar-track {
  background: var(--midnight-blue);
}

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

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

/* ==================== 选择框样式 ==================== */
select.input-field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23f5f0eb' stroke-width='1.5' fill='none' opacity='0.45'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

select.input-field option {
  background: var(--deep-night);
  color: var(--text-primary);
}

/* ==================== 文件上传隐藏input ==================== */
input[type="file"] {
  display: none;
}